mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
scrolledwindow: Fix swapping out child
This was not working in the case that the existing child is not a scrollable. It showed up as crashes of the scrolling benchmark in gtk4-demo when switching examples.
This commit is contained in:
parent
8e6ec0b8a3
commit
10be40a8b1
@ -4166,20 +4166,16 @@ gtk_scrolled_window_set_child (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
if (priv->child)
|
||||
{
|
||||
if (!priv->auto_added_viewport)
|
||||
if (priv->auto_added_viewport)
|
||||
{
|
||||
scrollable_child = priv->child;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollable_child = gtk_viewport_get_child (GTK_VIEWPORT (priv->child));
|
||||
gtk_viewport_set_child (GTK_VIEWPORT (priv->child), NULL);
|
||||
}
|
||||
|
||||
g_object_set (scrollable_child,
|
||||
g_object_set (priv->child,
|
||||
"hadjustment", NULL,
|
||||
"vadjustment", NULL,
|
||||
NULL);
|
||||
|
||||
g_clear_pointer (&priv->child, gtk_widget_unparent);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user