From b1e0b325dbe776360e024cdbfc2ff4d8028b8a00 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn <alexxcons@xfce.org> Date: Sun, 16 May 2021 23:12:45 +0200 Subject: [PATCH] Proper destruction of member variables for thunar-launcher --- thunar/thunar-launcher.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 9c6a8c117..9ac8d1d65 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -448,6 +448,7 @@ thunar_launcher_init (ThunarLauncher *launcher) launcher->files_to_process = NULL; launcher->device_to_process = NULL; launcher->location_to_process = NULL; + launcher->parent_folder = NULL; /* grab a reference on the preferences */ launcher->preferences = thunar_preferences_get (); @@ -469,13 +470,22 @@ thunar_launcher_dispose (GObject *object) thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (launcher), NULL); thunar_launcher_set_widget (THUNAR_LAUNCHER (launcher), NULL); - /* disconnect from the currently selected files */ - thunar_g_list_free_full (launcher->files_to_process); + /* unref all members */ + if (launcher->files_to_process != NULL) + thunar_g_list_free_full (launcher->files_to_process); launcher->files_to_process = NULL; - /* unref parent, if any */ + if (launcher->device_to_process != NULL) + g_object_unref (launcher->device_to_process); + launcher->device_to_process = NULL; + + if (launcher->location_to_process != NULL) + g_object_unref (launcher->location_to_process); + launcher->location_to_process = NULL; + if (launcher->parent_folder != NULL) g_object_unref (launcher->parent_folder); + launcher->parent_folder = NULL; (*G_OBJECT_CLASS (thunar_launcher_parent_class)->dispose) (object); } -- GitLab