a11y: Fix crash in notebook
When the accessible was disposed before the notebook it referenced, the weak ref could still trigger. This works around it.
This commit is contained in:
@ -42,6 +42,8 @@ check_focus_tab (gpointer data)
|
|||||||
atk_obj = ATK_OBJECT (data);
|
atk_obj = ATK_OBJECT (data);
|
||||||
accessible = GTK_NOTEBOOK_ACCESSIBLE (atk_obj);
|
accessible = GTK_NOTEBOOK_ACCESSIBLE (atk_obj);
|
||||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_obj));
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_obj));
|
||||||
|
if (widget == NULL)
|
||||||
|
return FALSE;
|
||||||
notebook = GTK_NOTEBOOK (widget);
|
notebook = GTK_NOTEBOOK (widget);
|
||||||
|
|
||||||
accessible->idle_focus_id = 0;
|
accessible->idle_focus_id = 0;
|
||||||
@ -132,17 +134,6 @@ page_removed_cb (GtkNotebook *notebook,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
accessible_destroyed (gpointer data)
|
|
||||||
{
|
|
||||||
GtkNotebookAccessible *accessible = GTK_NOTEBOOK_ACCESSIBLE (data);
|
|
||||||
|
|
||||||
if (accessible->idle_focus_id)
|
|
||||||
{
|
|
||||||
g_source_remove (accessible->idle_focus_id);
|
|
||||||
accessible->idle_focus_id = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void
|
static void
|
||||||
gtk_notebook_accessible_initialize (AtkObject *obj,
|
gtk_notebook_accessible_initialize (AtkObject *obj,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
@ -171,8 +162,6 @@ gtk_notebook_accessible_initialize (AtkObject *obj,
|
|||||||
g_signal_connect (notebook, "page-removed",
|
g_signal_connect (notebook, "page-removed",
|
||||||
G_CALLBACK (page_removed_cb), NULL);
|
G_CALLBACK (page_removed_cb), NULL);
|
||||||
|
|
||||||
g_object_weak_ref (G_OBJECT (notebook), (GWeakNotify)accessible_destroyed, obj);
|
|
||||||
|
|
||||||
obj->role = ATK_ROLE_PAGE_TAB_LIST;
|
obj->role = ATK_ROLE_PAGE_TAB_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user