From 81873994da3a2977cf9228a3f2f357a14c04a1a1 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 27 Sep 2016 22:41:17 -0300 Subject: [PATCH] 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(+) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index f32f8fa6..a09b0c66 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 0f512c20..83289bb8 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;