From 7a0be99fb4e69cef35a05beeed02eb2ad72a7df2 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Sat, 23 Feb 2013 21:46:53 -0800 Subject: 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. --- src/evbp-plug.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); +} -- cgit v1.2.3