mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-02 17:00:19 +00:00
widget: Properly remove event controllers in finalize
We were mutating the list while iterating over it. This was not a problem before since remove_controller just set the controller pointer to NULL instead of actually removing it from the list of controllers.
This commit is contained in:
parent
3a8607190f
commit
3edd24fb01
@ -8572,15 +8572,18 @@ gtk_widget_finalize (GObject *object)
|
|||||||
|
|
||||||
_gtk_size_request_cache_free (&priv->requests);
|
_gtk_size_request_cache_free (&priv->requests);
|
||||||
|
|
||||||
for (l = priv->event_controllers; l; l = l->next)
|
l = priv->event_controllers;
|
||||||
|
while (l)
|
||||||
{
|
{
|
||||||
|
GList *next = l->next;
|
||||||
GtkEventController *controller = l->data;
|
GtkEventController *controller = l->data;
|
||||||
|
|
||||||
if (controller)
|
if (controller)
|
||||||
gtk_widget_remove_controller (widget, controller);
|
gtk_widget_remove_controller (widget, controller);
|
||||||
|
|
||||||
|
l = next;
|
||||||
}
|
}
|
||||||
g_list_free (priv->event_controllers);
|
g_assert (priv->event_controllers == NULL);
|
||||||
priv->event_controllers = NULL;
|
|
||||||
|
|
||||||
if (_gtk_widget_get_first_child (widget) != NULL)
|
if (_gtk_widget_get_first_child (widget) != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user