summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2013-02-23 22:04:33 -0800
committerDan Nicholson <dbn.lists@gmail.com>2013-02-23 22:06:45 -0800
commit17a838b9b101dae9dac0a72f81f0892ee01dadd6 (patch)
treecb5206a98a8088ff7beda0295790985d7b033c89
parent95fb67d69f4638a97ed69f01fc758c7d2a48b2dd (diff)
evbp: Protect against SetWindow after plug has been destroyed
For some reason, Epiphany (WebKitGtk) likes to send a last SetWindow even as it's in the process of destroying the widget. Check whether the plug is still a GtkWindow before telling it to resize to the Window we're being told about.
-rw-r--r--src/evbp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/evbp.c b/src/evbp.c
index 5fcee76..648a621 100644
--- a/src/evbp.c
+++ b/src/evbp.c
@@ -202,10 +202,14 @@ evbp_set_window(NPP instance, NPWindow *window)
/* Create a plug from the window id or just resize the existing one
* appropriately. */
if (priv->plug) {
- g_debug("resizing existing plug to %ux%u", window->width,
- window->height);
- gtk_window_resize(GTK_WINDOW(priv->plug), window->width,
- window->height);
+ /* epiphany likes to throw one more set_window even after the widget
+ * has been destroyed. */
+ if (GTK_IS_WINDOW(priv->plug)) {
+ g_debug("resizing existing plug to %ux%u", window->width,
+ window->height);
+ gtk_window_resize(GTK_WINDOW(priv->plug), window->width,
+ window->height);
+ }
} else {
Window id = (Window)window->window;