[gnome-calendar] edit-dialog: remove unnecessary condition check
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] edit-dialog: remove unnecessary condition check
- Date: Mon, 24 Jul 2017 14:49:49 +0000 (UTC)
commit 6db25eacd6906084ac20f3b32c296762eaf40109
Author: Yash Singh <yashdev10p gmail com>
Date: Fri Jul 14 23:20:16 2017 +0530
edit-dialog: remove unnecessary condition check
An unnecessary condition check for assigning recurrence-changed
property of edit-dialog was causing a segmentation fault.
This patch removes this condition check and assigns the
recurrence-changed property correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=782755
src/gcal-edit-dialog.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 156e970..eefa6ef 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -810,11 +810,6 @@ gcal_edit_dialog_action_button_clicked (GtkWidget *widget,
old_recur = gcal_event_get_recurrence (dialog->event);
freq = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->repeat_combo));
- remove_recurrence_properties (dialog->event);
-
- if ((!old_recur && freq != GCAL_RECURRENCE_NO_REPEAT) || old_recur->frequency != freq)
- dialog->recurrence_changed = TRUE;
-
if (freq != GCAL_RECURRENCE_NO_REPEAT)
{
GcalRecurrence *recur;
@@ -828,11 +823,29 @@ gcal_edit_dialog_action_button_clicked (GtkWidget *widget,
else if (recur->limit_type == GCAL_RECURRENCE_COUNT)
recur->limit.count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
(dialog->number_of_occurrences_spin));
+ /* Only apply the new recurrence if it's different from the old one */
if (!gcal_recurrence_is_equal (old_recur, recur))
- gcal_event_set_recurrence (dialog->event, recur);
+ {
+ /* Remove the previous recurrence... */
+ remove_recurrence_properties (dialog->event);
+
+ /* ... and set the new one */
+ gcal_event_set_recurrence (dialog->event, recur);
+
+ dialog->recurrence_changed = TRUE;
+ }
g_clear_pointer (&recur, gcal_recurrence_free);
}
+ else
+ {
+ /* When NO_REPEAT is set, make sure to remove the old recurrent */
+ remove_recurrence_properties (dialog->event);
+
+ /* If the recurrence from an recurrent event was removed, mark it as changed */
+ if (old_recur && old_recur->frequency != GCAL_RECURRENCE_NO_REPEAT)
+ dialog->recurrence_changed = TRUE;
+ }
/* Update the source if needed */
if (dialog->selected_source &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]