From bbd29b69c6cc917c2827939855c27c9653d3be1f Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sun, 23 Jul 2017 11:36:05 +0100 Subject: [PATCH] Fix critical error when Gnucash closes with report pages open Prior to Gtk version 3.20, when using gtk_container_remove the removed widget was required to be the direct child of the container. --- src/html/gnc-html-webkit2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/html/gnc-html-webkit2.c b/src/html/gnc-html-webkit2.c index 70badc6969..a5ae409622 100644 --- a/src/html/gnc-html-webkit2.c +++ b/src/html/gnc-html-webkit2.c @@ -245,8 +245,15 @@ gnc_html_webkit_dispose( GObject* obj ) if ( priv->web_view != NULL ) { + // In Gtk Version 3.20 they relaxed the fact that the widget should be a + // direct child of the container otherwise it would be a critical error +#if GTK_CHECK_VERSION(3,20,0) gtk_container_remove( GTK_CONTAINER(priv->base.container), GTK_WIDGET(priv->web_view) ); +#else + GtkWidget *parent = gtk_widget_get_parent(GTK_WIDGET(priv->web_view)); + gtk_container_remove( GTK_CONTAINER(priv->base.container), parent); +#endif priv->web_view = NULL; }