[gimp/metadata-browser] app: properly detach floating selection in dispose()



commit a274ae1f71bd3946a275c0677e94314c7d86595e
Author: Michael Natterer <mitch gimp org>
Date:   Fri Sep 23 19:55:24 2011 +0200

    app: properly detach floating selection in dispose()
    
    We crash when closing an image that has a floating selection and the
    GEGL projection is being used. Detach the floating selection when
    either the FS or the drawable it's attached to are disposed. This fix
    only makes it crash later, but makes sense as separate commit.

 app/core/gimpdrawable.c |   16 +++++++++++++---
 app/core/gimplayer.c    |    7 +++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 2bd684f..cf87a05 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -74,6 +74,7 @@ enum
 
 static void  gimp_drawable_pickable_iface_init (GimpPickableInterface *iface);
 
+static void       gimp_drawable_dispose            (GObject           *object);
 static void       gimp_drawable_finalize           (GObject           *object);
 
 static gint64     gimp_drawable_get_memsize        (GimpObject        *object,
@@ -218,6 +219,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
                   gimp_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
 
+  object_class->dispose              = gimp_drawable_dispose;
   object_class->finalize             = gimp_drawable_finalize;
 
   gimp_object_class->get_memsize     = gimp_drawable_get_memsize;
@@ -275,12 +277,20 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
 }
 
 static void
-gimp_drawable_finalize (GObject *object)
+gimp_drawable_dispose (GObject *object)
 {
   GimpDrawable *drawable = GIMP_DRAWABLE (object);
 
-  if (drawable->private->fs_opacity_node)
-    gimp_drawable_sync_source_node (drawable, TRUE);
+  if (gimp_drawable_get_floating_sel (drawable))
+    gimp_drawable_detach_floating_sel (drawable);
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_drawable_finalize (GObject *object)
+{
+  GimpDrawable *drawable = GIMP_DRAWABLE (object);
 
   if (drawable->private->tiles)
     {
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 783598a..aea711e 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -402,6 +402,13 @@ gimp_layer_dispose (GObject *object)
                                           gimp_layer_layer_mask_update,
                                           layer);
 
+  if (gimp_layer_is_floating_sel (layer))
+    {
+      GimpDrawable *fs_drawable = gimp_layer_get_floating_sel_drawable (layer);
+
+      gimp_drawable_detach_floating_sel (fs_drawable);
+    }
+
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 



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