gimp r27889 - in trunk: . app/tools



Author: martinn
Date: Sun Jan  4 12:03:57 2009
New Revision: 27889
URL: http://svn.gnome.org/viewvc/gimp?rev=27889&view=rev

Log:
Bug 562213 â Align Tool doesn't work properly if it is the active
tool at startup

* app/tools/gimpaligntool.c: Perform NULL-pointer dodging to avoid
crashing.


Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpaligntool.c

Modified: trunk/app/tools/gimpaligntool.c
==============================================================================
--- trunk/app/tools/gimpaligntool.c	(original)
+++ trunk/app/tools/gimpaligntool.c	Sun Jan  4 12:03:57 2009
@@ -199,12 +199,19 @@
   align_tool = GIMP_ALIGN_TOOL (object);
   options    = G_OBJECT (gimp_tool_get_options (tool));
 
+  /* This line of code is evil because it relies on that the 'options'
+   * object is fully constructed before we get here, which is not
+   * guaranteed
+   */
   container = GTK_CONTAINER (g_object_get_data (options,
                                                 "controls-container"));
 
-  align_tool->controls = gimp_align_tool_controls (align_tool);
-  gtk_container_add (container, align_tool->controls);
-  gtk_widget_show (align_tool->controls);
+  if (container)
+    {
+      align_tool->controls = gimp_align_tool_controls (align_tool);
+      gtk_container_add (container, align_tool->controls);
+      gtk_widget_show (align_tool->controls);
+    }
 
   return object;
 }
@@ -427,8 +434,13 @@
     }
 
   for (i = 0; i < ALIGN_TOOL_NUM_BUTTONS; i++)
-    gtk_widget_set_sensitive (align_tool->button[i],
-                              (align_tool->selected_objects != NULL));
+    {
+      if (align_tool->button[i])
+        {
+          gtk_widget_set_sensitive (align_tool->button[i],
+                                    (align_tool->selected_objects != NULL));
+        }
+    }
 
   align_tool->x1 = align_tool->x0;
   align_tool->y1 = align_tool->y0;



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