Merge branch 'fix-a11y-text-signals-again' into 'main'

a11y: Avoid a crash

Closes #6146

See merge request GNOME/gtk!6470
This commit is contained in:
Matthias Clasen
2023-10-11 01:06:55 +00:00

View File

@@ -705,27 +705,19 @@ emit_text_changed (GtkAtSpiContext *self,
int end,
const char *text)
{
char *copy = NULL;
if (self->connection == NULL)
return;
/* Protect against possible non-UTF8 garbage after the end
* that g_variant_new_string() will complain about.
*/
if (text[end] != '\0')
text = copy = g_strndup (text, end);
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Object",
"TextChanged",
g_variant_new ("(siiva{sv})",
kind, start, end, g_variant_new_string (text), NULL),
kind, start, end,
g_variant_new_take_string (g_strndup (text, end)),
NULL),
NULL);
g_free (copy);
}
static void