[gnome-calendar] week-header: use a proper function to queue redraw



commit 97698ad1c91306e378ca7dec2d5b2009c97536e5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Mar 10 07:57:55 2017 -0300

    week-header: use a proper function to queue redraw
    
    We were using gtk_widget_queue_draw() as a callback to
    a GTimeoutSource, which expects a boolean return type.
    This is clearly wrong, and has the chance to cause
    a segmentation fault.
    
    Fix that by passing a function with the apropriate signature.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779823

 src/views/gcal-week-header.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index 93c8a74..bfa3ccf 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -984,6 +984,14 @@ on_expand_action_activated (GcalWeekHeader *self,
     header_expand (self);
 }
 
+static gboolean
+on_redraw_timeout_cb (gpointer data)
+{
+  gtk_widget_queue_draw (data);
+
+  return G_SOURCE_CONTINUE;
+}
+
 /* Drawing area content and size */
 static gdouble
 get_weekday_names_height (GtkWidget *widget)
@@ -1339,7 +1347,7 @@ gcal_week_header_draw (GtkWidget      *widget,
   if (self->redraw_timeout_id == 0)
     {
       self->redraw_timeout_id = g_timeout_add_seconds (5,
-                                                       (GSourceFunc) gtk_widget_queue_draw,
+                                                       (GSourceFunc) on_redraw_timeout_cb,
                                                        self);
     }
 


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