[gimp/soc-2010-cage-2] tools: Fix some warnings I introduced into cage tool earlyer



commit 28cfa9d3df88bbf54a99b45a4dd38211a07922d3
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Aug 15 02:58:31 2010 +0300

    tools: Fix some warnings I introduced into cage tool earlyer

 app/tools/gimpcagetool.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/app/tools/gimpcagetool.c b/app/tools/gimpcagetool.c
index 1c45aae..2c1f6f3 100644
--- a/app/tools/gimpcagetool.c
+++ b/app/tools/gimpcagetool.c
@@ -301,7 +301,7 @@ gimp_cage_tool_button_press (GimpTool              *tool,
                                                        coords->x,
                                                        coords->y,
                                                        HANDLE_SIZE);
-    if (ct->handle_moved > 0)
+    if (ct->handle_moved > 0 && ct->idle_id > 0)
       {
         g_source_remove(ct->idle_id);
         ct->idle_id = 0; /*Stop preview update for now*/
@@ -433,8 +433,11 @@ gimp_cage_tool_key_press (GimpTool    *tool,
         gimp_image_map_abort (ct->image_map);
         g_object_unref (ct->image_map);
         ct->image_map = NULL;
-        g_source_remove(ct->idle_id);
-        ct->idle_id = 0; /*Stop preview update for now*/
+        if (ct->idle_id)
+          {
+            g_source_remove(ct->idle_id);
+            ct->idle_id = 0; /*Stop preview update for now*/
+          }
         gimp_cage_tool_process (ct, display); /*RUN IT BABY*/
       }
       return TRUE;
@@ -544,13 +547,14 @@ gimp_cage_tool_oper_update  (GimpTool         *tool,
   GimpDrawTool    *draw_tool   = GIMP_DRAW_TOOL (tool);
   GimpCageOptions *options     = GIMP_CAGE_TOOL_GET_OPTIONS (ct);
   GimpCageConfig  *config      = ct->config;
-  gint             active_handle;
-
-  active_handle = gimp_cage_config_is_on_handle (config,
-                                             options->cage_mode,
-                                             coords->x,
-                                             coords->y,
-                                             HANDLE_SIZE);
+  gint             active_handle = -1;
+
+  if (config)
+    active_handle = gimp_cage_config_is_on_handle (config,
+                                                   options->cage_mode,
+                                                   coords->x,
+                                                   coords->y,
+                                                   HANDLE_SIZE);
   if (!ct->cage_complete || (active_handle > -1))
     {
       gimp_draw_tool_pause (draw_tool);



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