[gimp] app: date string in the About dialog was not always freed.



commit 3fa68be264da844293377a100a954e73fef477b1
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 22 12:01:38 2021 +0200

    app: date string in the About dialog was not always freed.
    
    Let's move the g_date_time_format() to the inner block when it's
    actually used, hence also make sure we allocate and free at the same
    code level, which is a better practice to limit leaks.
    
    Reported by Massimo.

 app/dialogs/about-dialog.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 982ee3f094..c5d7eec93f 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -304,11 +304,6 @@ about_dialog_add_update (GimpAboutDialog *dialog,
   vbox = children->data;
   g_list_free (children);
 
-  /* The preferred localized date representation without the time. */
-  datetime = g_date_time_new_from_unix_local (config->last_release_timestamp);
-  date = g_date_time_format (datetime, "%x");
-  g_date_time_unref (datetime);
-
   /* The update frame. */
   frame = gtk_frame_new (NULL);
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 2);
@@ -359,6 +354,11 @@ about_dialog_add_update (GimpAboutDialog *dialog,
                         (GCallback) about_dialog_download_clicked,
                         "https://www.gimp.org/downloads/";);
 
+      /* The preferred localized date representation without the time. */
+      datetime = g_date_time_new_from_unix_local (config->last_release_timestamp);
+      date = g_date_time_format (datetime, "%x");
+      g_date_time_unref (datetime);
+
       if (config->last_revision > 0)
         {
           /* This is actually a new revision of current version. */


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