[gimp] app: in gimp_display_empty(), clear image of matching contexts



commit 49e57f8d6e392833503e213fc653735b9765d43b
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.

 app/display/gimpdisplay.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 38a5026197..709f95f09a 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -717,6 +717,7 @@ void
 gimp_display_empty (GimpDisplay *display)
 {
   GimpDisplayPrivate *private;
+  GList              *iter;
 
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
@@ -724,6 +725,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]