[gnome-control-center] datetime: Fix crash when loading the panel



commit 4b2d32e53f4574595d4b39be2545efcd886d6f81
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Tue Feb 1 17:44:39 2022 +0530

    datetime: Fix crash when loading the panel
    
    When the month row value is changed, the signal callback uses
    the year value from the year spin button.  So set year value
    before month is set so that the year is set to a valid value
    thus avoiding a crash with invalid year.

 panels/datetime/cc-datetime-panel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 65f5b8601..c1e6aaa04 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -861,10 +861,6 @@ setup_datetime_dialog (CcDateTimePanel *self)
                                               GTK_STYLE_PROVIDER (provider),
                                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 
-  /* Month */
-  self->month = g_date_time_get_month (self->date);
-  adw_combo_row_set_selected (self->month_row, self->month - 1);
-
   /* Day */
   num_days = g_date_get_days_in_month (g_date_time_get_month (self->date),
                                        g_date_time_get_year (self->date));
@@ -883,6 +879,10 @@ setup_datetime_dialog (CcDateTimePanel *self)
                                   adjustment);
   g_signal_connect_object (G_OBJECT (self->year_spinbutton), "value-changed",
                            G_CALLBACK (month_year_changed), self, G_CONNECT_SWAPPED);
+
+  /* Month */
+  self->month = g_date_time_get_month (self->date);
+  adw_combo_row_set_selected (self->month_row, self->month - 1);
 }
 
 static int


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