widget: Take a ref during ::unrealize emission

In order to prevent invalid memory access/crashes if the widget is
destroyed in a callback of that signal.

https://bugzilla.gnome.org/show_bug.cgi?id=745829
This commit is contained in:
Carlos Garnacho 2015-03-16 16:20:21 +01:00
parent f5f6ad9981
commit b4e61b759b

View File

@ -5566,6 +5566,7 @@ gtk_widget_unrealize (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_object_ref (widget);
gtk_widget_push_verify_invariants (widget);
if (widget->priv->has_shape_mask)
@ -5592,6 +5593,7 @@ gtk_widget_unrealize (GtkWidget *widget)
}
gtk_widget_pop_verify_invariants (widget);
g_object_unref (widget);
}
/*****************************************