[gtk/matthiasc/for-master: 1/2] textview: Properly delete anchored children




commit 7082624fd72dd42bbb1b8908195ed8b29a7baac5
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 16 22:58:58 2020 -0400

    textview: Properly delete anchored children
    
    When we remove anchors with widgets from the text
    buffer, we used to call gtk_widget_destroy(), which
    indirectly called gtk_container_remove() which cleared
    the child properly. When gtk_widget_destroy() was
    removed, we replaced the calls with gtk_widget_unparent(),
    but that is not enough. Explicitly call
    gtk_text_view_remove() instead - we know the parent
    is a text view.

 gtk/gtktextchild.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c
index f569a503bd..4d5e30e44f 100644
--- a/gtk/gtktextchild.c
+++ b/gtk/gtktextchild.c
@@ -236,8 +236,8 @@ child_segment_delete_func (GtkTextLineSegment *seg,
     {
       GtkWidget *child = tmp_list->data;
 
-      gtk_widget_unparent (child);
-      
+      gtk_text_view_remove (GTK_TEXT_VIEW (gtk_widget_get_parent (child)), child);
+
       tmp_list = tmp_list->next;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]