[gimp/gimp-2-10] app: clear navigation editor when last image is closed



commit 0b6c63c0cced1a1555ada1d3071010719eae5bce
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.
    
    (cherry picked from commit 2c9a8a567b953548234b3c2d2b4e4859d03d92eb)

 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 45be1fa064..0996447286 100644
--- a/app/display/gimpnavigationeditor.c
+++ b/app/display/gimpnavigationeditor.c
@@ -192,7 +192,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);
@@ -219,6 +219,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]