[Xfce4-commits] [xfce/xfce4-panel] 01/01: arrow-button: Remove timeout on dispose (Bug #15696)

noreply at xfce.org noreply at xfce.org
Mon Jul 15 00:21:57 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 0bf9842cfa78a7e89ab1022f39ce60049ab0203f
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Wed Jul 10 09:33:50 2019 +0200

    arrow-button: Remove timeout on dispose (Bug #15696)
    
    The blinking source timeout has a GDestroyNotify function associated
    that will update the button when the timeout is removed.
    
    But the timeout is removed on the button finalize, i.e. once the object
    is freed, which will lead to a crash trying to access memory already
    freed.
    
    I think the original author meant to use `dispose` instead of `finalize`
    for removing the blinking timeout.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 libxfce4panel/xfce-arrow-button.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index 0879a20..dc61d10 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -74,7 +74,7 @@ static void     xfce_arrow_button_get_property         (GObject               *o
                                                         guint                  prop_id,
                                                         GValue                *value,
                                                         GParamSpec            *pspec);
-static void     xfce_arrow_button_finalize             (GObject               *object);
+static void     xfce_arrow_button_dispose              (GObject               *object);
 #if GTK_CHECK_VERSION (3, 0, 0)
 static gboolean xfce_arrow_button_draw                 (GtkWidget             *widget,
                                                         cairo_t               *cr);
@@ -132,7 +132,7 @@ xfce_arrow_button_class_init (XfceArrowButtonClass * klass)
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->get_property = xfce_arrow_button_get_property;
   gobject_class->set_property = xfce_arrow_button_set_property;
-  gobject_class->finalize = xfce_arrow_button_finalize;
+  gobject_class->dispose = xfce_arrow_button_dispose;
 
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
 #if GTK_CHECK_VERSION (3, 0, 0)
@@ -265,14 +265,17 @@ xfce_arrow_button_get_property (GObject    *object,
 
 
 static void
-xfce_arrow_button_finalize (GObject *object)
+xfce_arrow_button_dispose (GObject *object)
 {
   XfceArrowButton *button = XFCE_ARROW_BUTTON (object);
 
   if (button->priv->blinking_timeout_id != 0)
-    g_source_remove (button->priv->blinking_timeout_id);
+    {
+      g_source_remove (button->priv->blinking_timeout_id);
+      button->priv->blinking_timeout_id = 0;
+    }
 
-  (*G_OBJECT_CLASS (xfce_arrow_button_parent_class)->finalize) (object);
+  (*G_OBJECT_CLASS (xfce_arrow_button_parent_class)->dispose) (object);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list