Commit d609d342 authored by Theo Linkspfeifer's avatar Theo Linkspfeifer 💬 Committed by Alexander Schwinn
Browse files

Fix memory leak (Issue #573)



Co-authored-by: Alexander Schwinn's avatarAlexander Schwinn <alexxcons@xfce.org>
parent 45d096be
......@@ -5726,6 +5726,8 @@ static void
thunar_window_location_toolbar_add_ucas (ThunarWindow *window)
{
ThunarxProviderFactory *provider_factory;
ThunarFile *home_folder;
GFile *home_gfile;
GList *providers;
GList *thunarx_menu_items = NULL;
GList *lp_provider;
......@@ -5733,6 +5735,13 @@ thunar_window_location_toolbar_add_ucas (ThunarWindow *window)
GList *toolbar_container_children;
guint item_count;
/* determine the file for the home directory */
home_gfile = thunar_g_file_new_for_home ();
home_folder = thunar_file_get (home_gfile, NULL);
g_object_unref (home_gfile);
if (home_folder == NULL)
return;
/* get number of items in the toolbar */
toolbar_container_children = gtk_container_get_children (GTK_CONTAINER (window->location_toolbar));
item_count = g_list_length (toolbar_container_children);
......@@ -5748,7 +5757,8 @@ thunar_window_location_toolbar_add_ucas (ThunarWindow *window)
/* load the menu items offered by the menu providers */
for (lp_provider = providers; lp_provider != NULL; lp_provider = lp_provider->next)
{
thunarx_menu_items = thunarx_menu_provider_get_folder_menu_items (lp_provider->data, GTK_WIDGET (window), THUNARX_FILE_INFO (thunar_file_get (thunar_g_file_new_for_home (), NULL)));
thunarx_menu_items = thunarx_menu_provider_get_folder_menu_items (lp_provider->data, GTK_WIDGET (window),
THUNARX_FILE_INFO (home_folder));
for (lp_item = thunarx_menu_items; lp_item != NULL; lp_item = lp_item->next)
{
......@@ -5779,8 +5789,11 @@ thunar_window_location_toolbar_add_ucas (ThunarWindow *window)
g_list_free_full (thunarx_menu_items, g_object_unref);
}
g_list_free_full (providers, g_object_unref);
}
g_object_unref (home_folder);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment