textview: properly remove anchored widgets

Fixes #3021
This commit is contained in:
Christian Hergert 2020-08-05 14:08:07 -07:00
parent 750f9917e3
commit 5ff2b8535f

View File

@ -2053,7 +2053,7 @@ gtk_text_view_set_buffer (GtkTextView *text_view,
while (priv->anchored_children.length) while (priv->anchored_children.length)
{ {
AnchoredChild *ac = g_queue_peek_head (&priv->anchored_children); AnchoredChild *ac = g_queue_peek_head (&priv->anchored_children);
gtk_widget_unparent (ac->widget); gtk_text_view_remove (text_view, ac->widget);
/* ac is now invalid! */ /* ac is now invalid! */
} }