From 1b3c1fb9cb66c1b2d62da5e5421c9a26f3b324f4 Mon Sep 17 00:00:00 2001 From: Ell Date: Tue, 10 Sep 2019 17:47:19 +0300 Subject: [PATCH] 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. --- 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 245942f77c..7b39127424 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -199,6 +199,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) @@ -211,6 +225,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; @@ -220,12 +237,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);