From 072d6b0d12f099ebd2829417f14f9c75a7546758 Mon Sep 17 00:00:00 2001 From: Ell Date: Thu, 30 Aug 2018 03:28:47 -0400 Subject: [PATCH] Issue #2120 - Segmentation fault while using Levels to white balance a layer Move the call to gimp_filter_tool_disable_color_picking() from the filter-tool's dialog "unmap" handler to gimp_filter_tool_halt(). Since commit ec80a885139ac60de83cf1e785da2a68165d576f, we explicitly destroy the GUI when halting the filter tool, which happens before the dialog's unmap handler is called, which could potentially result in a dangling pointer to the active color-picker widget in gimp_filter_tool_disable_color_picking(). --- app/tools/gimpfiltertool.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c index 61bfa37902..e3893096ea 100644 --- a/app/tools/gimpfiltertool.c +++ b/app/tools/gimpfiltertool.c @@ -149,8 +149,6 @@ static void gimp_filter_tool_halt (GimpFilterTool *filter_to static void gimp_filter_tool_commit (GimpFilterTool *filter_tool); static void gimp_filter_tool_dialog (GimpFilterTool *filter_tool); -static void gimp_filter_tool_dialog_unmap (GtkWidget *dialog, - GimpFilterTool *filter_tool); static void gimp_filter_tool_reset (GimpFilterTool *filter_tool); static void gimp_filter_tool_create_filter (GimpFilterTool *filter_tool); @@ -937,6 +935,8 @@ gimp_filter_tool_halt (GimpFilterTool *filter_tool) { GimpTool *tool = GIMP_TOOL (filter_tool); + gimp_filter_tool_disable_color_picking (filter_tool); + if (filter_tool->gui) { /* explicitly clear the dialog contents first, since we might be called @@ -1026,17 +1026,6 @@ static void gimp_filter_tool_dialog (GimpFilterTool *filter_tool) { GIMP_FILTER_TOOL_GET_CLASS (filter_tool)->dialog (filter_tool); - - g_signal_connect (gimp_tool_gui_get_dialog (filter_tool->gui), "unmap", - G_CALLBACK (gimp_filter_tool_dialog_unmap), - filter_tool); -} - -static void -gimp_filter_tool_dialog_unmap (GtkWidget *dialog, - GimpFilterTool *filter_tool) -{ - gimp_filter_tool_disable_color_picking (filter_tool); } static void