[gimp] app: fix possible warning when removing layers, channels or vectors



commit 616285fa7de28937df3f1f732e86085371c6a6ac
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 4 01:49:32 2011 +0100

    app: fix possible warning when removing layers, channels or vectors
    
    Don't call gimp_viewable_is_ancestor() on a NULL ancestor.

 app/core/gimpimage.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index c0b8d52..43b1c43 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3695,9 +3695,10 @@ gimp_image_remove_layer (GimpImage *image,
        */
       floating_sel_activate_drawable (layer);
     }
-  else if (layer == active_layer ||
-           gimp_viewable_is_ancestor (GIMP_VIEWABLE (layer),
-                                      GIMP_VIEWABLE (active_layer)))
+  else if (active_layer &&
+           (layer == active_layer ||
+            gimp_viewable_is_ancestor (GIMP_VIEWABLE (layer),
+                                       GIMP_VIEWABLE (active_layer))))
     {
       gimp_image_set_active_layer (image, new_active);
     }
@@ -3869,9 +3870,10 @@ gimp_image_remove_channel (GimpImage   *image,
                                               GIMP_ITEM (channel),
                                               GIMP_ITEM (new_active)));
 
-  if (channel == active_channel ||
-      gimp_viewable_is_ancestor (GIMP_VIEWABLE (channel),
-                                 GIMP_VIEWABLE (active_channel)))
+  if (active_channel &&
+      (channel == active_channel ||
+       gimp_viewable_is_ancestor (GIMP_VIEWABLE (channel),
+                                  GIMP_VIEWABLE (active_channel))))
     {
       if (new_active)
         gimp_image_set_active_channel (image, new_active);
@@ -3953,9 +3955,10 @@ gimp_image_remove_vectors (GimpImage   *image,
                                               GIMP_ITEM (vectors),
                                               GIMP_ITEM (new_active)));
 
-  if (vectors == active_vectors ||
-      gimp_viewable_is_ancestor (GIMP_VIEWABLE (vectors),
-                                 GIMP_VIEWABLE (active_vectors)))
+  if (active_vectors &&
+      (vectors == active_vectors ||
+       gimp_viewable_is_ancestor (GIMP_VIEWABLE (vectors),
+                                  GIMP_VIEWABLE (active_vectors))))
     {
       gimp_image_set_active_vectors (image, new_active);
     }



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