[gimp/gimp-2-10] app: fix CRITICAL in GimpNavigationEditor



commit 10b05d42df7f9a65fa25fb3a9863fb70d73f0fa4
Author: Ell <ell_se yahoo com>
Date:   Tue Sep 10 17:47:19 2019 +0300

    app: fix CRITICAL in GimpNavigationEditor
    
    ... after commit 2c9a8a567b953548234b3c2d2b4e4859d03d92eb.  Don't
    use the same function as a handler for GimpContext::display-changed
    and GimpContext::image-changed -- their signatures are different.
    
    (cherry picked from commit 1b3c1fb9cb66c1b2d62da5e5421c9a26f3b324f4)

 app/display/gimpnavigationeditor.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c
index 0996447286..19306d2e8f 100644
--- a/app/display/gimpnavigationeditor.c
+++ b/app/display/gimpnavigationeditor.c
@@ -198,6 +198,20 @@ gimp_navigation_editor_display_changed (GimpContext          *context,
   gimp_navigation_editor_set_shell (editor, shell);
 }
 
+static void
+gimp_navigation_editor_image_chaged (GimpContext          *context,
+                                     GimpImage            *image,
+                                     GimpNavigationEditor *editor)
+{
+  GimpDisplay      *display = gimp_context_get_display (context);
+  GimpDisplayShell *shell   = NULL;
+
+  if (display && image)
+    shell = gimp_display_get_shell (display);
+
+  gimp_navigation_editor_set_shell (editor, shell);
+}
+
 static void
 gimp_navigation_editor_set_context (GimpDocked  *docked,
                                     GimpContext *context)
@@ -210,6 +224,9 @@ gimp_navigation_editor_set_context (GimpDocked  *docked,
       g_signal_handlers_disconnect_by_func (editor->context,
                                             gimp_navigation_editor_display_changed,
                                             editor);
+      g_signal_handlers_disconnect_by_func (editor->context,
+                                            gimp_navigation_editor_image_chaged,
+                                            editor);
     }
 
   editor->context = context;
@@ -219,12 +236,12 @@ 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.
+      /* make sure to also call gimp_navigation_editor_set_shell() when the
+       * last image is closed, even though the display isn't changed, so that
+       * the editor is properly cleared.
        */
       g_signal_connect (context, "image-changed",
-                        G_CALLBACK (gimp_navigation_editor_display_changed),
+                        G_CALLBACK (gimp_navigation_editor_image_chaged),
                         editor);
 
       display = gimp_context_get_display (context);


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