[gimp/gimp-2-10] app: in gimp_display_empty(), clear image of matching contexts



commit d2b98a670000cc8d901d76fe85f474cbd0b58296
Author: Ell <ell_se yahoo com>
Date:   Tue Jan 8 10:00:51 2019 -0500

    app: in gimp_display_empty(), clear image of matching contexts
    
    In gimp_display_empty(), clear the image of all contexts whose
    display is the current display, so that, in particular, when
    subsequently updating the action groups, which causes certain
    actions to be activated, the image that used to be bound to the
    display is not found through the user context.  This avoids re-
    validating the image projection when closing the last image,
    postponing image destruction.
    
    (cherry picked from commit 49e57f8d6e392833503e213fc653735b9765d43b)

 app/display/gimpdisplay.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 7429c2da7f..04439043a0 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -725,6 +725,7 @@ void
 gimp_display_empty (GimpDisplay *display)
 {
   GimpDisplayPrivate *private;
+  GList              *iter;
 
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
@@ -732,6 +733,14 @@ gimp_display_empty (GimpDisplay *display)
 
   g_return_if_fail (GIMP_IS_IMAGE (private->image));
 
+  for (iter = display->gimp->context_list; iter; iter = g_list_next (iter))
+    {
+      GimpContext *context = iter->data;
+
+      if (gimp_context_get_display (context) == display)
+        gimp_context_set_image (context, NULL);
+    }
+
   gimp_display_set_image (display, NULL);
 
   gimp_display_shell_empty (gimp_display_get_shell (display));


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