Merge lp:~junrrein/pantheon-files/fix-1184104-yeah into lp:~elementary-apps/pantheon-files/trunk

Proposed by Julián Unrrein
Status: Merged
Approved by: Victor Martinez
Approved revision: 1214
Merged at revision: 1217
Proposed branch: lp:~junrrein/pantheon-files/fix-1184104-yeah
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 59 lines (+17/-0)
2 files modified
src/fm-list-view.c (+16/-0)
src/fm-list-view.h (+1/-0)
To merge this branch: bzr merge lp:~junrrein/pantheon-files/fix-1184104-yeah
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
elementary Apps team Pending
Review via email: mp+169071@code.launchpad.net

Commit message

When destroying a list view, unload the loaded subdirectories so that signal handlers get disconnected, preventing crashes.

Description of the change

When destroying a list view, unload the loaded subdirectories so that signal handlers get disconnected, preventing crashes.

To post a comment you must log in.
1213. By Julián Unrrein

Merge changes from trunk.

1214. By Julián Unrrein

Remove an unnecesary g_list_free after iterating over a list.

Revision history for this message
Victor Martinez (victored) wrote :

Works fine here

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/fm-list-view.c'
2--- src/fm-list-view.c 2013-06-01 20:18:10 +0000
3+++ src/fm-list-view.c 2013-06-14 00:13:42 +0000
4@@ -99,6 +99,10 @@
5 if (!gtk_tree_view_row_expanded (unload_data->view->tree,
6 path)) {
7 fm_list_model_unload_subdirectory (model, &iter);
8+ //Remove the unloaded subdirectory from the subdirectories list.
9+ unload_data->view->loaded_subdirectories = g_list_remove (
10+ unload_data->view->loaded_subdirectories,
11+ unload_data->directory);
12 }
13 gtk_tree_path_free (path);
14 }
15@@ -119,6 +123,8 @@
16
17 if (fm_list_model_load_subdirectory (view->model, path, &directory)) {
18 fm_directory_view_add_subdirectory (FM_DIRECTORY_VIEW (view), directory);
19+ //Add the subdirectory to the loaded subdirectories list.
20+ view->loaded_subdirectories = g_list_append (view->loaded_subdirectories, directory);
21 }
22 }
23
24@@ -885,6 +891,15 @@
25
26 g_debug ("%s\n", G_STRFUNC);
27
28+ //Unload all the subdirectories in the loaded subdirectories list.
29+ GList *l = NULL;
30+ for (l = view->loaded_subdirectories; l != NULL; l = l->next) {
31+ GOFDirectoryAsync *directory = GOF_DIRECTORY_ASYNC (l->data);
32+ fm_directory_view_remove_subdirectory (FM_DIRECTORY_VIEW (view), directory);
33+ }
34+
35+ g_list_free (view->loaded_subdirectories);
36+
37 g_free (view->details->original_name);
38 view->details->original_name = NULL;
39
40@@ -900,6 +915,7 @@
41 {
42 view->details = g_new0 (FMListViewDetails, 1);
43 view->details->selection = NULL;
44+ view->loaded_subdirectories = NULL;
45
46 create_and_set_up_tree_view (view);
47
48
49=== modified file 'src/fm-list-view.h'
50--- src/fm-list-view.h 2011-12-18 03:39:58 +0000
51+++ src/fm-list-view.h 2013-06-14 00:13:42 +0000
52@@ -46,6 +46,7 @@
53 FMListModel *model;
54
55 FMListViewDetails *details;
56+ GList *loaded_subdirectories;
57 } FMListView;
58
59 typedef struct {

Subscribers

People subscribed via source and target branches

to all changes: