summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgaoboqwq <[email protected]>2026-03-03 11:27:53 +0800
committerVictor Kareh <[email protected]>2026-03-12 16:48:04 -0400
commit38e7ea062cb114fa8940a27b00e68e73285a8173 (patch)
tree89820f67f49d8494114f57c308db166db6d21a79 /src
parent6123e3886e9b65891a8b1bf7bb11425a4d98200c (diff)
downloadcaja-master.tar.bz2
caja-master.tar.xz
fix(*): fix some memory leak problemHEADmaster
Signed-off-by: gaobo <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/caja-bookmarks-sidebar.c3
-rw-r--r--src/caja-information-panel.c1
-rw-r--r--src/caja-navigation-window.c5
-rw-r--r--src/caja-window-manage-views.c8
-rw-r--r--src/file-manager/fm-directory-view.c1
5 files changed, 15 insertions, 3 deletions
diff --git a/src/caja-bookmarks-sidebar.c b/src/caja-bookmarks-sidebar.c
index 61709e35..33d56eaf 100644
--- a/src/caja-bookmarks-sidebar.c
+++ b/src/caja-bookmarks-sidebar.c
@@ -143,8 +143,6 @@ update_bookmarks (CajaBookmarksSidebar *sidebar)
continue;
}
- bookmark_uri = caja_bookmark_get_uri (bookmark);
-
root = caja_bookmark_get_location (bookmark);
file = caja_file_get (root);
@@ -167,6 +165,7 @@ update_bookmarks (CajaBookmarksSidebar *sidebar)
-1);
/* Select the bookmark if we're in the directory the bookmark points to. */
+ bookmark_uri = caja_bookmark_get_uri (bookmark);
if (g_strcmp0 (bookmark_uri, sidebar->current_uri) == 0)
gtk_tree_selection_select_iter (selection, &iter);
diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c
index 41a2c493..e2939813 100644
--- a/src/caja-information-panel.c
+++ b/src/caja-information-panel.c
@@ -998,7 +998,6 @@ selection_changed_callback (CajaWindowInfo *window,
GFile *selected;
CajaFile *file;
- selection = caja_window_info_get_selection (window);
selected = selection->data;
/* this should never fail here, as we're displaying the file */
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c
index 0cdbb1dd..606c0422 100644
--- a/src/caja-navigation-window.c
+++ b/src/caja-navigation-window.c
@@ -634,6 +634,11 @@ caja_navigation_window_destroy (GtkWidget *object)
caja_navigation_window_unset_focus_widget (window);
+ if (window->details->header_size_group != NULL)
+ {
+ g_object_unref (window->details->header_size_group);
+ window->details->header_size_group = NULL;
+ }
window->sidebar = NULL;
g_list_foreach (window->sidebar_panels, (GFunc)g_object_unref, NULL);
g_list_free (window->sidebar_panels);
diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c
index 1ba1a533..f0eb8792 100644
--- a/src/caja-window-manage-views.c
+++ b/src/caja-window-manage-views.c
@@ -908,6 +908,7 @@ begin_location_change (CajaWindowSlot *slot,
CajaDirectory *directory;
gboolean force_reload;
GFile *parent;
+ gboolean is_need_free_selection = FALSE;
g_assert (slot != NULL);
g_assert (location != NULL);
@@ -930,6 +931,7 @@ begin_location_change (CajaWindowSlot *slot,
parent = g_file_get_parent (from_folder);
}
if (parent != NULL) {
+ is_need_free_selection = TRUE;
new_selection = g_list_prepend (NULL, g_object_ref(from_folder));
}
g_object_unref (from_folder);
@@ -1016,6 +1018,12 @@ begin_location_change (CajaWindowSlot *slot,
got_file_info_for_view_selection_callback,
slot);
+ // If the externally passed 'new_selection' is NULL, the caller will not unref the content of 'new_selection'.
+ // In this case, it is necessary to manually unref.
+ if (is_need_free_selection)
+ {
+ g_list_free_full (new_selection, g_object_unref);
+ }
g_object_unref (window);
}
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index e18a433e..11979f89 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -5100,6 +5100,7 @@ add_extension_menu_items (FMDirectoryView *view,
caja_menu_item_list_free (children);
g_free (subdir);
+ g_object_unref (menu);
}
}
}