[gimp/gimp-2-8] app: remove a weak ptr when the object lives longer than the ptr



commit c3bf36f3d6d64ac400f0c696be5b3d0034fb3601
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Mon Jun 4 19:32:41 2012 +0200

    app: remove a weak ptr when the object lives longer than the ptr
    
    Closing the display filter editor with a filter selected
    in the listview on the right, used to produce (quitting GIMP):
    
    ==32359== Invalid write of size 8
    ==32359==    at 0x8808DF5: g_nullify_pointer (glib/glib/gutils.c:2099)
    ==32359==    by 0x8358781: weak_refs_notify (glib/gobject/gobject.c:2469)
    ==32359==    by 0x4C3730A: gimp_color_display_dispose (gimp-2-8/libgimpwidgets/gimpcolordisplay.c:197)
    ==32359==    by 0x83596A7: g_object_unref (glib/gobject/gobject.c:2986)
    ==32359==    by 0x4C37EFA: gimp_color_display_stack_dispose (gimp-2-8/libgimpwidgets/gimpcolordisplaystack.c:150)
    ==32359==    by 0x83596A7: g_object_unref (glib/gobject/gobject.c:2986)
    ==32359==    by 0x53F1C3: gimp_display_shell_filter_set (gimp-2-8/app/display/gimpdisplayshell-filter.c:58)
    ==32359==    by 0x536A50: gimp_display_shell_dispose (gimp-2-8/app/display/gimpdisplayshell.c:765)

 app/widgets/gimpcolordisplayeditor.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c
index 183dcd0..3b8c875 100644
--- a/app/widgets/gimpcolordisplayeditor.c
+++ b/app/widgets/gimpcolordisplayeditor.c
@@ -334,6 +334,13 @@ gimp_color_display_editor_dispose (GObject *object)
 {
   GimpColorDisplayEditor *editor = GIMP_COLOR_DISPLAY_EDITOR (object);
 
+  if (editor->selected)
+    {
+      g_object_remove_weak_pointer (G_OBJECT (editor->selected),
+                                    (gpointer) &editor->selected);
+      editor->selected = NULL;
+    }
+
   if (editor->stack)
     {
       g_object_unref (editor->stack);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]