gui/calendar-navigation-button: Fix memory leak

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/865>
This commit is contained in:
Hari Rana
2026-10-04 14:06:44 +00:00
committed by Marge Bot
parent 6f511b600a
commit e27e477e69
+6 -1
View File
@@ -96,6 +96,9 @@ gcal_calendar_navigation_button_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_ACTIVE_DATE: case PROP_ACTIVE_DATE:
{
g_autofree char *format = NULL;
gcal_clear_date_time (&self->active_date); gcal_clear_date_time (&self->active_date);
self->active_date = g_date_time_ref (g_value_get_boxed (value)); self->active_date = g_date_time_ref (g_value_get_boxed (value));
/* /*
@@ -103,7 +106,9 @@ gcal_calendar_navigation_button_set_property (GObject *object,
* More formats can be found on the doc: * More formats can be found on the doc:
* https://docs.gtk.org/glib/method.DateTime.format.html * https://docs.gtk.org/glib/method.DateTime.format.html
*/ */
gtk_menu_button_set_label (self->button, g_date_time_format (self->active_date, _ ("%OB %Y"))); format = g_date_time_format (self->active_date, _ ("%OB %Y"));
gtk_menu_button_set_label (self->button, format);
}
break; break;
case PROP_ACTIVE: case PROP_ACTIVE: