[gtk+/portal-race: 22/129] scrolledwindow: Properly remove scrollbars



commit dae9d3769cd1a968c2061ddf47a13456405becf8
Author: Timm Bäder <mail baedert org>
Date:   Sat May 27 09:47:56 2017 +0200

    scrolledwindow: Properly remove scrollbars
    
    Instead of keeping an extra ref, then unparent+destroy+unref, don't keep
    an extra ref and just unparent the scrollbar when appropriate.

 gtk/gtkscrolledwindow.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 5b817ad..f24df8b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2015,7 +2015,6 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
       priv->hscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
 
       gtk_widget_set_parent (priv->hscrollbar, GTK_WIDGET (scrolled_window));
-      g_object_ref (priv->hscrollbar);
       update_scrollbar_positions (scrolled_window);
     }
   else
@@ -2082,7 +2081,6 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
       priv->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
 
       gtk_widget_set_parent (priv->vscrollbar, GTK_WIDGET (scrolled_window));
-      g_object_ref (priv->vscrollbar);
       update_scrollbar_positions (scrolled_window);
     }
   else
@@ -2532,8 +2530,6 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
                                            gtk_scrolled_window_adjustment_changed,
                                            scrolled_window);
       gtk_widget_unparent (priv->hscrollbar);
-      gtk_widget_destroy (priv->hscrollbar);
-      g_object_unref (priv->hscrollbar);
       priv->hscrollbar = NULL;
     }
   if (priv->vscrollbar)
@@ -2542,8 +2538,6 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
                                            gtk_scrolled_window_adjustment_changed,
                                            scrolled_window);
       gtk_widget_unparent (priv->vscrollbar);
-      gtk_widget_destroy (priv->vscrollbar);
-      g_object_unref (priv->vscrollbar);
       priv->vscrollbar = NULL;
     }
 


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