[gimp] app: clear navigation editor when last image is closed



commit 2c9a8a567b953548234b3c2d2b4e4859d03d92eb
Author: Ell <ell_se yahoo com>
Date:   Tue Sep 10 15:11:48 2019 +0300

    app: clear navigation editor when last image is closed
    
    In GimpNavigationEditor, make sure to clear the editor's shell when
    the last image is closed, even though the corresponding display is
    stil alive, so that we don't needlessly extend the lifetime of the
    image.  This is necessary after the recent GimpImageViewable
    changes, since the editor now (indirectly) holds a reference on the
    image.

 app/display/gimpnavigationeditor.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c
index 88f1d3665c..245942f77c 100644
--- a/app/display/gimpnavigationeditor.c
+++ b/app/display/gimpnavigationeditor.c
@@ -193,7 +193,7 @@ gimp_navigation_editor_display_changed (GimpContext          *context,
 {
   GimpDisplayShell *shell = NULL;
 
-  if (display)
+  if (display && gimp_display_get_image (display))
     shell = gimp_display_get_shell (display);
 
   gimp_navigation_editor_set_shell (editor, shell);
@@ -220,6 +220,13 @@ gimp_navigation_editor_set_context (GimpDocked  *docked,
       g_signal_connect (context, "display-changed",
                         G_CALLBACK (gimp_navigation_editor_display_changed),
                         editor);
+      /* make sure to also run gimp_navigation_editor_display_changed() when\
+       * the last image is closed, but its display doesn't, so that the editor
+       * is properly cleared.
+       */
+      g_signal_connect (context, "image-changed",
+                        G_CALLBACK (gimp_navigation_editor_display_changed),
+                        editor);
 
       display = gimp_context_get_display (context);
     }


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