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.
This commit is contained in:
Jehan 2016-06-05 20:53:02 +02:00
parent ffd97c0eb8
commit b5934625de
3 changed files with 12 additions and 3 deletions

View file

@ -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,

View file

@ -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)
{

View file

@ -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__ */