[gimp/gimp-2-10] app: avoid freezing image preview if drawable is not attached



commit c347f8770c689a4fa38e62a5d1edb6cddbb0fb7b
Author: Ell <ell_se yahoo com>
Date:   Thu Mar 28 12:35:32 2019 -0400

    app: avoid freezing image preview if drawable is not attached
    
    When freezing/thawing a top-level drawable's preview, only freeze/
    thaw the image preview if the drawable is attached.
    
    (cherry picked from commit de36e33347815e78aee34f7fcd5cb3e22414af03)

 app/core/gimpdrawable.c  | 10 ++++++----
 app/core/gimplayermask.c | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index a35c041c9f..3b78b147aa 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -425,10 +425,11 @@ gimp_drawable_preview_freeze (GimpViewable *viewable)
 {
   GimpViewable *parent = gimp_viewable_get_parent (viewable);
 
-  if (! parent)
+  if (! parent && gimp_item_is_attached (GIMP_ITEM (viewable)))
     parent = GIMP_VIEWABLE (gimp_item_get_image (GIMP_ITEM (viewable)));
 
-  gimp_viewable_preview_freeze (parent);
+  if (parent)
+    gimp_viewable_preview_freeze (parent);
 }
 
 static void
@@ -436,10 +437,11 @@ gimp_drawable_preview_thaw (GimpViewable *viewable)
 {
   GimpViewable *parent = gimp_viewable_get_parent (viewable);
 
-  if (! parent)
+  if (! parent && gimp_item_is_attached (GIMP_ITEM (viewable)))
     parent = GIMP_VIEWABLE (gimp_item_get_image (GIMP_ITEM (viewable)));
 
-  gimp_viewable_preview_thaw (parent);
+  if (parent)
+    gimp_viewable_preview_thaw (parent);
 }
 
 static GeglNode *
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index 8c3dc97f71..95b82b929b 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -101,10 +101,11 @@ gimp_layer_mask_preview_freeze (GimpViewable *viewable)
     {
       GimpViewable *parent = gimp_viewable_get_parent (GIMP_VIEWABLE (layer));
 
-      if (! parent)
+      if (! parent && gimp_item_is_attached (GIMP_ITEM (layer)))
         parent = GIMP_VIEWABLE (gimp_item_get_image (GIMP_ITEM (layer)));
 
-      gimp_viewable_preview_freeze (parent);
+      if (parent)
+        gimp_viewable_preview_freeze (parent);
     }
 }
 
@@ -118,10 +119,11 @@ gimp_layer_mask_preview_thaw (GimpViewable *viewable)
     {
       GimpViewable *parent = gimp_viewable_get_parent (GIMP_VIEWABLE (layer));
 
-      if (! parent)
+      if (! parent && gimp_item_is_attached (GIMP_ITEM (layer)))
         parent = GIMP_VIEWABLE (gimp_item_get_image (GIMP_ITEM (layer)));
 
-      gimp_viewable_preview_thaw (parent);
+      if (parent)
+        gimp_viewable_preview_thaw (parent);
     }
 }
 


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