[eog/gnome-3-38] Merge branch 'unref-file-list' into 'master'



commit 000d1d47fde257dc20232bd7afcb18a42108e0fc
Author: Felix Riemann <friemann gnome org>
Date:   Tue Nov 3 18:04:51 2020 +0000

    Merge branch 'unref-file-list' into 'master'
    
    Free file_list if reopen in single-window
    
    See merge request GNOME/eog!81
    
    (cherry picked from commit 7c8b486ea83bc5609d996a0e9ae661c7389a6e60)
    
    9d07533f Free file_list if reopen in single-window
    2170891e Revert "Free file_list if reopen in single-window"
    e0a237ad Fix memory leak when using flag EOG_STARTUP_SINGLE_WINDOW

 src/eog-window.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index a8b720de..131d0b37 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -4472,6 +4472,7 @@ eog_window_init (EogWindow *window)
        priv->view_settings = g_settings_new (EOG_CONF_VIEW);
        priv->lockdown_settings = g_settings_new (EOG_CONF_DESKTOP_LOCKDOWN_SCHEMA);
 
+       window->priv->file_list = NULL;
        window->priv->store = NULL;
        window->priv->image = NULL;
 
@@ -5247,6 +5248,14 @@ eog_window_open_file_list (EogWindow *window, GSList *file_list)
 
        window->priv->status = EOG_WINDOW_STATUS_INIT;
 
+       /* Free the list to avoid memory leak
+        * when using flag EOG_STARTUP_SINGLE_WINDOW
+        */
+       if (window->priv->file_list != NULL) {
+               g_slist_foreach (window->priv->file_list, (GFunc) g_object_unref, NULL);
+               g_slist_free (window->priv->file_list);
+       }
+
        g_slist_foreach (file_list, (GFunc) g_object_ref, NULL);
        window->priv->file_list = file_list;
 


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