[gimp/cage: 99/130] Bug 630376 - Crash with text layer / text tools stay on canvas when text info is discarded



commit 6374b9b487a3845f85c0fe897be7b49e96046432
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 28 15:28:28 2010 +0100

    Bug 630376 - Crash with text layer / text tools stay on canvas when text info is discarded
    
    Halt the tool when the text layer's text disappears.

 app/tools/gimptexttool.c |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index c44b2b2..5052081 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -138,14 +138,14 @@ static void      gimp_text_tool_connect         (GimpTextTool      *text_tool,
                                                  GimpText          *text);
 
 static void      gimp_text_tool_layer_notify    (GimpTextLayer     *layer,
-                                                 GParamSpec        *pspec,
+                                                 const GParamSpec  *pspec,
                                                  GimpTextTool      *text_tool);
 static void      gimp_text_tool_proxy_notify    (GimpText          *text,
-                                                 GParamSpec        *pspec,
+                                                 const GParamSpec  *pspec,
                                                  GimpTextTool      *text_tool);
 
 static void      gimp_text_tool_text_notify     (GimpText          *text,
-                                                 GParamSpec        *pspec,
+                                                 const GParamSpec  *pspec,
                                                  GimpTextTool      *text_tool);
 static void      gimp_text_tool_text_changed    (GimpText          *text,
                                                  GimpTextTool      *text_tool);
@@ -1069,26 +1069,35 @@ gimp_text_tool_connect (GimpTextTool  *text_tool,
       text_tool->layer = layer;
 
       if (layer)
-        g_signal_connect_object (text_tool->layer, "notify::modified",
+        g_signal_connect_object (text_tool->layer, "notify",
                                  G_CALLBACK (gimp_text_tool_layer_notify),
                                  text_tool, 0);
     }
 }
 
 static void
-gimp_text_tool_layer_notify (GimpTextLayer *layer,
-                             GParamSpec    *pspec,
-                             GimpTextTool  *text_tool)
+gimp_text_tool_layer_notify (GimpTextLayer    *layer,
+                             const GParamSpec *pspec,
+                             GimpTextTool     *text_tool)
 {
-  if (layer->modified)
-    gimp_tool_control (GIMP_TOOL (text_tool), GIMP_TOOL_ACTION_HALT,
-                       GIMP_TOOL (text_tool)->display);
+  if (! strcmp (pspec->name, "modified"))
+    {
+      if (layer->modified)
+        gimp_tool_control (GIMP_TOOL (text_tool), GIMP_TOOL_ACTION_HALT,
+                           GIMP_TOOL (text_tool)->display);
+    }
+  else if (! strcmp (pspec->name, "text"))
+    {
+      if (! layer->text)
+        gimp_tool_control (GIMP_TOOL (text_tool), GIMP_TOOL_ACTION_HALT,
+                           GIMP_TOOL (text_tool)->display);
+    }
 }
 
 static void
-gimp_text_tool_proxy_notify (GimpText     *text,
-                             GParamSpec   *pspec,
-                             GimpTextTool *text_tool)
+gimp_text_tool_proxy_notify (GimpText         *text,
+                             const GParamSpec *pspec,
+                             GimpTextTool     *text_tool)
 {
   if (! text_tool->text)
     return;
@@ -1097,7 +1106,7 @@ gimp_text_tool_proxy_notify (GimpText     *text,
     {
       gimp_text_tool_block_drawing (text_tool);
 
-      text_tool->pending = g_list_append (text_tool->pending, pspec);
+      text_tool->pending = g_list_append (text_tool->pending, (gpointer) pspec);
 
       if (text_tool->idle_id)
         g_source_remove (text_tool->idle_id);
@@ -1110,9 +1119,9 @@ gimp_text_tool_proxy_notify (GimpText     *text,
 }
 
 static void
-gimp_text_tool_text_notify (GimpText     *text,
-                            GParamSpec   *pspec,
-                            GimpTextTool *text_tool)
+gimp_text_tool_text_notify (GimpText         *text,
+                            const GParamSpec *pspec,
+                            GimpTextTool     *text_tool)
 {
   g_return_if_fail (text == text_tool->text);
 



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