[gnome-calendar] views: protect against invalid drop



commit 81873994da3a2977cf9228a3f2f357a14c04a1a1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Sep 27 22:41:17 2016 -0300

    views: protect against invalid drop
    
    If the user tries to drop a e.g. file, GNOME Calendar crashes
    immediately.
    
    While the desired behavior would be checking if that's an ics file,
    lets just not crash for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771680

 src/gcal-month-view.c |    4 ++++
 src/gcal-year-view.c  |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index f32f8fa..a09b0c6 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -879,6 +879,10 @@ gcal_month_view_drag_drop (GtkWidget      *widget,
 
   cell = get_dnd_cell (widget, x, y);
   event_widget = gtk_drag_get_source_widget (context);
+
+  if (!GCAL_IS_EVENT_WIDGET (event_widget))
+    return FALSE;
+
   event = gcal_event_widget_get_event (GCAL_EVENT_WIDGET (event_widget));
 
   /* Move the event's date */
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 0f512c2..83289bb 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -1342,6 +1342,9 @@ navigator_drag_drop_cb (GcalYearView   *self,
 
   if (calculate_day_month_for_coord (self, x, y, &day, &month, &is_title))
     {
+      if (!GCAL_IS_EVENT_WIDGET (gtk_drag_get_source_widget (context)))
+        return FALSE;
+
       if (!is_title)
         {
           GcalEventWidget *event_widget;


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