[gimp] Bug 751333 - Crash when moving cursor with ibus "Hangul" input method.



commit b5934625de2bede256350b4ae14912e29e5a86b2
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 5 20:53:02 2016 +0200

    Bug 751333 - Crash when moving cursor with ibus "Hangul" input method.
    
    Commit cd147a4 reintroduced the crash. The culprit was the idle function
    gimp_text_tool_apply_idle() which may not have been processed when
    gimp_text_tool_move_cursor() is called, resulting in inconsistencies
    between the text in the text tool's pango layout and its buffer.
    Force any pending text commits to be applied before moving the cursor.

 app/tools/gimptexttool-editor.c |    9 +++++++++
 app/tools/gimptexttool.c        |    4 +---
 app/tools/gimptexttool.h        |    2 ++
 3 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index acae5be..6d18e0c 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -716,6 +716,15 @@ gimp_text_tool_move_cursor (GimpTextTool    *text_tool,
   gboolean       cancel_selection = FALSE;
   gint           x_pos  = -1;
 
+  if (text_tool->pending)
+    {
+      /* If there are any pending text commits, there would be
+       * inconsistencies between the text_tool->buffer and layout.
+       * This could result in crashes. See bug 751333.
+       * Therefore we apply them first.
+       */
+      gimp_text_tool_apply (text_tool, TRUE);
+    }
   GIMP_LOG (TEXT_EDITING, "%s count = %d, select = %s",
             g_enum_get_value (g_type_class_ref (GTK_TYPE_MOVEMENT_STEP),
                               step)->value_name,
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index aadab32..0249678 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -146,8 +146,6 @@ static void      gimp_text_tool_text_notify     (GimpText          *text,
 static void      gimp_text_tool_text_changed    (GimpText          *text,
                                                  GimpTextTool      *text_tool);
 
-static gboolean  gimp_text_tool_apply           (GimpTextTool      *text_tool,
-                                                 gboolean           push_undo);
 static void      gimp_text_tool_apply_list      (GimpTextTool      *text_tool,
                                                  GList             *pspecs);
 
@@ -1267,7 +1265,7 @@ gimp_text_tool_text_changed (GimpText     *text,
   gimp_text_tool_unblock_drawing (text_tool);
 }
 
-static gboolean
+gboolean
 gimp_text_tool_apply (GimpTextTool *text_tool,
                       gboolean      push_undo)
 {
diff --git a/app/tools/gimptexttool.h b/app/tools/gimptexttool.h
index 054a353..1440a40 100644
--- a/app/tools/gimptexttool.h
+++ b/app/tools/gimptexttool.h
@@ -119,6 +119,8 @@ void       gimp_text_tool_create_vectors_warped  (GimpTextTool *text_tool);
 /*  only for the text editor  */
 void       gimp_text_tool_clear_layout           (GimpTextTool *text_tool);
 gboolean   gimp_text_tool_ensure_layout          (GimpTextTool *text_tool);
+gboolean   gimp_text_tool_apply                  (GimpTextTool *text_tool,
+                                                  gboolean      push_undo);
 
 
 #endif /* __GIMP_TEXT_TOOL_H__ */


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