[evince] ev-window.c: don't leave freed elements on list



commit a6c2b94450bb5cf10fe8b4ed432a5bcc0f353b4c
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Sat Jul 14 17:26:37 2018 +0500

    ev-window.c: don't leave freed elements on list
    
    because will cause crashes when the list is used
    again.
    
    See reproduce steps in:
    https://gitlab.gnome.org/GNOME/evince/merge_requests/7#note_259010
    
    Also take the chance to use g_list_free_full()
    instead of its more verbose corresponding code.

 shell/ev-window.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index dbb6e74a..94b46e0c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -5222,6 +5222,7 @@ view_menu_annot_popup (EvWindow     *ev_window,
 
                                g_list_free_full (ev_window->priv->attach_list,
                                                  g_object_unref);
+                               ev_window->priv->attach_list = NULL;
                                ev_window->priv->attach_list =
                                        g_list_prepend (ev_window->priv->attach_list,
                                                        g_object_ref (attachment));
@@ -5825,10 +5826,7 @@ ev_window_dispose (GObject *object)
        }
 
        if (priv->attach_list) {
-               g_list_foreach (priv->attach_list,
-                               (GFunc) g_object_unref,
-                               NULL);
-               g_list_free (priv->attach_list);
+               g_list_free_full (priv->attach_list, g_object_unref);
                priv->attach_list = NULL;
        }
 


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