widgetpaintable: Don't emit signals on dispose

This commit is contained in:
Benjamin Otte 2019-03-27 03:41:03 +01:00
parent d3be32f8ea
commit 5dd5ff5236

View File

@ -190,12 +190,24 @@ gtk_widget_paintable_get_property (GObject *object,
} }
} }
static void
gtk_widget_paintable_unset_widget (GtkWidgetPaintable *self)
{
if (self->widget == NULL)
return;
self->widget->priv->paintables = g_slist_remove (self->widget->priv->paintables,
self);
self->widget = NULL;
}
static void static void
gtk_widget_paintable_dispose (GObject *object) gtk_widget_paintable_dispose (GObject *object)
{ {
GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (object); GtkWidgetPaintable *self = GTK_WIDGET_PAINTABLE (object);
gtk_widget_paintable_set_widget (self, NULL); gtk_widget_paintable_unset_widget (self);
G_OBJECT_CLASS (gtk_widget_paintable_parent_class)->dispose (object); G_OBJECT_CLASS (gtk_widget_paintable_parent_class)->dispose (object);
} }
@ -311,11 +323,7 @@ gtk_widget_paintable_set_widget (GtkWidgetPaintable *self,
if (self->widget == widget) if (self->widget == widget)
return; return;
if (self->widget) gtk_widget_paintable_unset_widget (self);
{
self->widget->priv->paintables = g_slist_remove (self->widget->priv->paintables,
self);
}
/* We do not ref the widget to not cause ref cycles when a widget /* We do not ref the widget to not cause ref cycles when a widget
* is told to observe itself or one of its parent. * is told to observe itself or one of its parent.