[gtk/dnd-leaks: 4/4] widgetpaintable: Clear an idle in dispose
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/dnd-leaks: 4/4] widgetpaintable: Clear an idle in dispose
- Date: Fri, 7 Aug 2020 00:03:17 +0000 (UTC)
commit a712ffa2ab92b33953ba872086f1c1194708eae1
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Aug 6 20:01:26 2020 -0400
widgetpaintable: Clear an idle in dispose
We were not removing the pending_update idle
in dispose, which is at least suspicious, if
not deadly. Move the idle cleanup code into
unset_widget(), which we are already calling
in dispose().
gtk/gtkwidgetpaintable.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwidgetpaintable.c b/gtk/gtkwidgetpaintable.c
index a2d6a0cc22..1ed017db9e 100644
--- a/gtk/gtkwidgetpaintable.c
+++ b/gtk/gtkwidgetpaintable.c
@@ -201,6 +201,13 @@ gtk_widget_paintable_unset_widget (GtkWidgetPaintable *self)
self);
self->widget = NULL;
+
+ g_clear_object (&self->pending_image);
+ if (self->pending_update_cb)
+ {
+ g_source_remove (self->pending_update_cb);
+ self->pending_update_cb = 0;
+ }
}
static void
@@ -332,19 +339,10 @@ gtk_widget_paintable_set_widget (GtkWidgetPaintable *self,
self->widget = widget;
if (widget)
- {
- widget->priv->paintables = g_slist_prepend (widget->priv->paintables,
- self);
- }
+ widget->priv->paintables = g_slist_prepend (widget->priv->paintables, self);
g_object_unref (self->current_image);
self->current_image = gtk_widget_paintable_snapshot_widget (self);
- g_clear_object (&self->pending_image);
- if (self->pending_update_cb)
- {
- g_source_remove (self->pending_update_cb);
- self->pending_update_cb = 0;
- }
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_WIDGET]);
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]