multipress: Only emit preedit signals if needed

When clearing the compose buffer, don't emit preedit-changed
unconditionally. This triggers a recursion which leads to
a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=753644
This commit is contained in:
Matthias Clasen 2015-08-18 15:42:56 -04:00
parent 9f9c5ca49a
commit 24174e5528

View File

@ -170,11 +170,14 @@ clear_compose_buffer (GtkImContextMultipress *multipress_context)
multipress_context->key_last_entered = 0;
multipress_context->compose_count = 0;
multipress_context->tentative_match = NULL;
cancel_automatic_timeout_commit (multipress_context);
g_signal_emit_by_name (multipress_context, "preedit-changed");
g_signal_emit_by_name (multipress_context, "preedit-end");
if (multipress_context->tentative_match)
{
multipress_context->tentative_match = NULL;
g_signal_emit_by_name (multipress_context, "preedit-changed");
g_signal_emit_by_name (multipress_context, "preedit-end");
}
}
/* Finish composing, provide the character, and clear our compose buffer.