[gimp] Issue #4967 - Crash when cancelling filters with aux inputs
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gimp] Issue #4967 - Crash when cancelling filters with aux inputs
- Date: Sat, 18 Apr 2020 14:53:44 +0000 (UTC)
commit 19c0d43c25b49d83be17b344dc47cc5e737f0e19
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.
 app/tools/gimpfiltertool.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index e73bef9ee2..c0da2bb0d6 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -911,23 +911,28 @@ 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-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-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]