[gimp] app: keep a reference to channels and vectors around removing them



commit 708555a378d95589263816a499759fbd99d1ba68
Author: Michael Natterer <mitch gimp org>
Date:   Mon Feb 7 11:35:58 2011 +0100

    app: keep a reference to channels and vectors around removing them
    
    because we temporarily need them after removal from their item trees,
    and bad things can happen if they are not kept alive by the undo stack
    (like when undo is disabled while loading an image).

 app/core/gimpimage.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index cc9a37e..764443b 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3857,6 +3857,8 @@ gimp_image_remove_channel (GimpImage   *image,
                                          gimp_item_get_index (GIMP_ITEM (channel)),
                                          active_channel);
 
+  g_object_ref (channel);
+
   new_active =
     GIMP_CHANNEL (gimp_item_tree_remove_item (private->channels,
                                               GIMP_ITEM (channel),
@@ -3870,6 +3872,8 @@ gimp_image_remove_channel (GimpImage   *image,
         gimp_image_unset_active_channel (image);
     }
 
+  g_object_unref (channel);
+
   if (undo_group)
     gimp_image_undo_group_end (image);
 }
@@ -3935,6 +3939,8 @@ gimp_image_remove_vectors (GimpImage   *image,
                                          gimp_item_get_index (GIMP_ITEM (vectors)),
                                          active_vectors);
 
+  g_object_ref (vectors);
+
   new_active =
     GIMP_VECTORS (gimp_item_tree_remove_item (private->vectors,
                                               GIMP_ITEM (vectors),
@@ -3942,6 +3948,8 @@ gimp_image_remove_vectors (GimpImage   *image,
 
   if (vectors == active_vectors)
     gimp_image_set_active_vectors (image, new_active);
+
+  g_object_unref (vectors);
 }
 
 gboolean



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