[gtk+/gtk-3-22] scrolledwindow: Properly remove scrollbars



commit 64d05b5dc6b82cdcf9c18b0520e97243233c10c8
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 400c542..83044f9 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2246,7 +2246,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);
       gtk_widget_show (priv->hscrollbar);
       update_scrollbar_positions (scrolled_window);
     }
@@ -2314,7 +2313,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);
       gtk_widget_show (priv->vscrollbar);
       update_scrollbar_positions (scrolled_window);
     }
@@ -2765,8 +2763,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)
@@ -2775,8 +2771,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]