summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-11-25 18:15:04 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2020-11-25 18:15:04 +0000
commit16b5a880978c66a254c8bd8a71c3e64b596abce2 (patch)
treecac743ae7271606cbddab8b7c6659f345f647b32
parentfdf2e046c3e83faf9d3b0f347b32e9dcc0415995 (diff)
downloadgtk+-16b5a880978c66a254c8bd8a71c3e64b596abce2.tar.gz
a11y: Check before disconnecting Text signals
Use the same initial check for the accessible object type that we use when connecting the signal, in case we try to disconnect signals on different widgets. Additionally, check before accessing data that might have already been removed. Fixes: #3403
-rw-r--r--gtk/a11y/gtkatspitext.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/a11y/gtkatspitext.c b/gtk/a11y/gtkatspitext.c
index 6c6fd79a46..7cf08fdf06 100644
--- a/gtk/a11y/gtkatspitext.c
+++ b/gtk/a11y/gtkatspitext.c
@@ -1526,9 +1526,15 @@ gtk_atspi_connect_text_signals (GtkAccessible *accessible,
void
gtk_atspi_disconnect_text_signals (GtkAccessible *accessible)
{
+ if (!GTK_IS_EDITABLE (accessible) &&
+ !GTK_IS_TEXT_VIEW (accessible))
+ return;
+
TextChanged *changed;
changed = g_object_get_data (G_OBJECT (accessible), "accessible-text-data");
+ if (changed == NULL)
+ return;
if (GTK_IS_EDITABLE (accessible))
{
@@ -1544,6 +1550,7 @@ gtk_atspi_disconnect_text_signals (GtkAccessible *accessible)
else if (GTK_IS_TEXT_VIEW (accessible))
{
g_signal_handlers_disconnect_by_func (accessible, buffer_changed, changed);
+
if (changed->buffer)
{
g_signal_handlers_disconnect_by_func (changed->buffer, insert_range_cb, changed);
@@ -1551,6 +1558,7 @@ gtk_atspi_disconnect_text_signals (GtkAccessible *accessible)
g_signal_handlers_disconnect_by_func (changed->buffer, delete_range_after_cb, changed);
g_signal_handlers_disconnect_by_func (changed->buffer, mark_set_cb, changed);
}
+
g_clear_object (&changed->buffer);
}