[nautilus/wip/csoriano/next-18: 13/13] files-view: fix management when using internal model
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/next-18: 13/13] files-view: fix management when using internal model
- Date: Mon, 18 Jan 2016 10:03:41 +0000 (UTC)
commit 21265296a96d01f4a89b0cdac99a5c2c63596ccd
Author: Carlos Soriano <csoriano gnome org>
Date: Fri Jan 15 17:52:07 2016 +0100
files-view: fix management when using internal model
We were leaking it in these cases. But we need to make sure
we don't free the directory if we are using the same as the
internal one. So manage that in the load_directory as a generic
function.
https://bugzilla.gnome.org/show_bug.cgi?id=759717
src/nautilus-files-view.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 087faf6..f67a5fb 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2331,12 +2331,6 @@ nautilus_files_view_set_show_hidden_files (NautilusFilesView *view,
show_hidden);
if (view->details->model != NULL) {
- /* We have to simulate that we are a client asking to swtich to a new
- * location, and of course we have our own ref to it. In this
- * case, the client (this function) and the server (the view) has the same
- * reference, and the server will unref its current model, giving
- * a "use after free" crash. So take a ref here. */
- nautilus_directory_ref (view->details->model);
load_directory (view, view->details->model);
}
}
@@ -6953,8 +6947,11 @@ load_directory (NautilusFilesView *view,
view->details->subdirectory_list->data);
}
- nautilus_directory_unref (view->details->model);
- view->details->model = nautilus_directory_ref (directory);
+ /* Avoid freeing it and won't be able to ref it */
+ if (view->details->model != directory) {
+ nautilus_directory_unref (view->details->model);
+ view->details->model = nautilus_directory_ref (directory);
+ }
g_clear_object (&view->details->directory_as_file);
view->details->directory_as_file = nautilus_directory_get_corresponding_file (directory);
@@ -7728,7 +7725,7 @@ set_search_query_internal (NautilusFilesView *files_view,
* search directory, so setting the location to a search
* directory when is already serching will enter a loop.
*/
- load_directory (files_view, nautilus_directory_ref (files_view->details->model));
+ load_directory (files_view, files_view->details->model);
} else {
NautilusDirectory *directory;
NautilusFile *file;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]