[gimp/gimp-2-10] Issue #4967 - Crash when cancelling filters with aux inputs



commit 21ce9d6b8f6d4d381ee66e84d2907a94ad94c2b6
Author: Ell <ell_se yahoo com>
Date:   Sat Apr 18 17:46:38 2020 +0300

    Issue #4967 - Crash when cancelling filters with aux inputs
    
    In gimp_filter_tool_real_config_notify(), make sure the incoming
    pspec in not NULL before accessing it.
    gimp_operation_tool_aux_input_notify() may emit "notify" on the
    config object with a NULL pspec.
    
    (cherry picked from commit 19c0d43c25b49d83be17b344dc47cc5e737f0e19)

 app/tools/gimpfiltertool.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index fdb1681bea..8b364e69f3 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -914,24 +914,29 @@ gimp_filter_tool_real_config_notify (GimpFilterTool   *filter_tool,
 
   if (filter_tool->filter)
     {
-      if (! strcmp (pspec->name, "gimp-clip")          ||
-          ! strcmp (pspec->name, "gimp-mode")          ||
-          ! strcmp (pspec->name, "gimp-opacity")       ||
-          ! strcmp (pspec->name, "gimp-color-managed") ||
-          ! strcmp (pspec->name, "gimp-gamma-hack"))
-        {
-          gimp_filter_tool_update_filter (filter_tool);
-        }
-      else if (! strcmp (pspec->name, "gimp-region"))
+      /* note that we may be called with a NULL pspec.  see
+       * gimp_operation_tool_aux_input_notify().
+       */
+      if (pspec)
         {
-          gimp_filter_tool_update_filter (filter_tool);
+          if (! strcmp (pspec->name, "gimp-clip")          ||
+              ! strcmp (pspec->name, "gimp-mode")          ||
+              ! strcmp (pspec->name, "gimp-opacity")       ||
+              ! strcmp (pspec->name, "gimp-color-managed") ||
+              ! strcmp (pspec->name, "gimp-gamma-hack"))
+            {
+              gimp_filter_tool_update_filter (filter_tool);
+            }
+          else if (! strcmp (pspec->name, "gimp-region"))
+            {
+              gimp_filter_tool_update_filter (filter_tool);
 
-          gimp_filter_tool_region_changed (filter_tool);
-        }
-      else if (options->preview)
-        {
-          gimp_drawable_filter_apply (filter_tool->filter, NULL);
+              gimp_filter_tool_region_changed (filter_tool);
+            }
         }
+
+      if (options->preview)
+        gimp_drawable_filter_apply (filter_tool->filter, NULL);
     }
 }
 


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