[gimp] Bug 615071 - invalid menu path crashes GIMP



commit 304db468d2fc0b96a5591d74d32c3275f4b74f83
Author: Sven Neumann <sven gimp org>
Date:   Wed Apr 7 21:05:38 2010 +0200

    Bug 615071 - invalid menu path crashes GIMP
    
    Warn and skip the procedure instead of crashing. This is just to fix
    the crash, a proper fix is about to follow.

 app/actions/plug-in-actions.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/app/actions/plug-in-actions.c b/app/actions/plug-in-actions.c
index 467ce10..682e0ca 100644
--- a/app/actions/plug-in-actions.c
+++ b/app/actions/plug-in-actions.c
@@ -438,10 +438,23 @@ plug_in_actions_add_proc (GimpActionGroup     *group,
       p1 = strrchr (path_original, '/');
       p2 = strrchr (path_translated, '/');
 
-      *p1 = '\0';
-      *p2 = '\0';
+      if (p1 && p2)
+        {
+          *p1 = '\0';
+          *p2 = '\0';
 
-      label = p2 + 1;
+          label = p2 + 1;
+        }
+      else
+        {
+          g_warning ("bad menu path for procedure \"%s\": \"%s\"",
+                     gimp_object_get_name (proc), path_original);
+
+          g_free (path_original);
+          g_free (path_translated);
+
+          return;
+        }
     }
 
   entry.name        = gimp_object_get_name (proc);



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