gimp r27590 - in branches/gimp-2-6: . app/dialogs app/paint



Author: martinn
Date: Sun Nov  9 20:49:44 2008
New Revision: 27590
URL: http://svn.gnome.org/viewvc/gimp?rev=27590&view=rev

Log:
Merged from trunk:

Bug 558549 â Stroking a single-point path with a paint tool
crashes GIMP

* app/paint/gimppaintcore-stroke.c
(gimp_paint_core_stroke_vectors): Return an error message if there
were not enough points to stroke.

* app/dialogs/stroke-dialog.c (stroke_dialog_response): Guard
against crashes if an implementator forgets to set an error.


Modified:
   branches/gimp-2-6/ChangeLog
   branches/gimp-2-6/app/dialogs/stroke-dialog.c
   branches/gimp-2-6/app/paint/gimppaintcore-stroke.c

Modified: branches/gimp-2-6/app/dialogs/stroke-dialog.c
==============================================================================
--- branches/gimp-2-6/app/dialogs/stroke-dialog.c	(original)
+++ branches/gimp-2-6/app/dialogs/stroke-dialog.c	Sun Nov  9 20:49:44 2008
@@ -318,9 +318,10 @@
         if (! gimp_item_stroke (item, drawable, context, desc, FALSE, NULL,
                                 &error))
           {
-            gimp_message (context->gimp, G_OBJECT (widget),
+            gimp_message (context->gimp,
+                          G_OBJECT (widget),
                           GIMP_MESSAGE_WARNING,
-                          error->message);
+                          error ? error->message : "NULL");
             g_clear_error (&error);
             return;
           }

Modified: branches/gimp-2-6/app/paint/gimppaintcore-stroke.c
==============================================================================
--- branches/gimp-2-6/app/paint/gimppaintcore-stroke.c	(original)
+++ branches/gimp-2-6/app/paint/gimppaintcore-stroke.c	Sun Nov  9 20:49:44 2008
@@ -33,6 +33,8 @@
 #include "gimppaintcore-stroke.h"
 #include "gimppaintoptions.h"
 
+#include "gimp-intl.h"
+
 
 static void gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
                                                      gint        length);
@@ -233,6 +235,7 @@
 {
   GList    *stroke;
   gboolean  initialized = FALSE;
+  gboolean  due_to_lack_of_points = FALSE;
   gint      off_x, off_y;
   gint      vectors_off_x, vectors_off_y;
 
@@ -306,6 +309,10 @@
               break;
             }
         }
+      else
+        {
+          due_to_lack_of_points = TRUE;
+        }
 
       if (coords)
         g_array_free (coords, TRUE);
@@ -318,6 +325,13 @@
       gimp_paint_core_cleanup (core);
     }
 
+  if (! initialized &&
+      due_to_lack_of_points &&
+      *error == NULL)
+    {
+      g_set_error (error, 0, 0, _("Not enough points to stroke"));
+    }
+
   return initialized;
 }
 



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