summaryrefslogtreecommitdiff
path: root/src/evbp-plug.c
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2013-02-23 21:46:53 -0800
committerDan Nicholson <dbn.lists@gmail.com>2013-02-23 22:07:02 -0800
commit7a0be99fb4e69cef35a05beeed02eb2ad72a7df2 (patch)
treeb036c540437bcae600d40dab135932cbbd161555 /src/evbp-plug.c
parenta2e76b7538ee60e3b2e56ec80f5a296315067696 (diff)
plug: Destroy child to avoid bugs in removing plug from socket
When GtkPlug is in the same process as GtkSocket, a complicated pile of code is invoked to remove the plug from the socket when the socket is being destroyed. This leads to the plug being in some dicey intermediate states where it is changing back to a toplevel and critical warnings are thrown from its contained widgets. Workaround this by just destroying the contained widget (the viewer) as soon as the plug removal can be detected.
Diffstat (limited to 'src/evbp-plug.c')
-rw-r--r--src/evbp-plug.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/evbp-plug.c b/src/evbp-plug.c
index 6e74f9a..87e3b06 100644
--- a/src/evbp-plug.c
+++ b/src/evbp-plug.c
@@ -27,9 +27,14 @@
G_DEFINE_TYPE(EvbpPlug, evbp_plug, GTK_TYPE_PLUG)
+static void evbp_plug_unmap(GtkWidget *widget);
+
static void
evbp_plug_class_init(EvbpPlugClass *class)
{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
+
+ widget_class->unmap = evbp_plug_unmap;
}
static void
@@ -48,3 +53,13 @@ evbp_plug_new(Window socket_id)
socket_id);
return GTK_WIDGET(plug);
}
+
+static void
+evbp_plug_unmap(GtkWidget *widget)
+{
+ /* Hack: destroy the child here to workaround bugs in GtkPlug */
+ g_debug("Destroying child prior to unmapping");
+ gtk_widget_destroy(gtk_bin_get_child(GTK_BIN(widget)));
+
+ GTK_WIDGET_CLASS(evbp_plug_parent_class)->unmap(widget);
+}