Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-fix-file-remote-type-search-crash into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic
- Git
- lp:~3v1n0/ubuntu/+source/nautilus
- ubuntu/bionic-fix-file-remote-type-search-crash
- Merge into ubuntu/bionic
Proposed by
Marco Trevisan (Treviño)
Status: | Superseded |
---|---|
Proposed branch: | ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-fix-file-remote-type-search-crash |
Merge into: | ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic |
Prerequisite: | ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-xubuntu-cancel-search |
Diff against target: |
439 lines (+136/-222) 8 files modified
debian/changelog (+4/-5) debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch (+1/-1) debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch (+1/-1) debian/patches/0018-search-engine-add-locate-based-search-engine.patch (+1/-1) debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch (+1/-1) debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch (+127/-0) debian/patches/series (+1/-1) dev/null (+0/-212) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Desktop | Pending | ||
Review via email: mp+355859@code.launchpad.net |
This proposal supersedes a proposal from 2018-09-28.
This proposal has been superseded by a proposal from 2018-10-04.
Commit message
Description of the change
To post a comment you must log in.
- fde29bc... by Marco Trevisan (Treviño)
-
Finalise changelog
Unmerged commits
- fde29bc... by Marco Trevisan (Treviño)
-
Finalise changelog
- 43a23ec... by Marco Trevisan (Treviño)
-
d/p/search-
engine- Query-file- system- to-determine- remoteness. patch Cherry-pick remote filesystem check on file during search.
Fixes LP: #1795028
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 312bb43..1d1673f 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,10 +1,9 @@ | |||
7 | 1 | nautilus (1:3.26.4-0~ubuntu18.04.2) UNRELEASED; urgency=medium | 1 | nautilus (1:3.26.4-0~ubuntu18.04.2) bionic; urgency=medium |
8 | 2 | 2 | ||
12 | 3 | * d/p/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch: | 3 | * d/p/search-engine-Query-file-system-to-determine-remoteness.patch: |
13 | 4 | shell-search-provider: implement XUbuntuCancel to request pending | 4 | - Fix remote filesystem check on file during search (LP: #1795028) |
11 | 5 | search cancellation from gnome-shell (LP: #1756826) | ||
14 | 6 | 5 | ||
16 | 7 | -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 05 Sep 2018 18:03:14 +0200 | 6 | -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 04 Oct 2018 16:15:08 +0200 |
17 | 8 | 7 | ||
18 | 9 | nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium | 8 | nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium |
19 | 10 | 9 | ||
20 | diff --git a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch | |||
21 | index f80997f..20e597c 100644 | |||
22 | --- a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch | |||
23 | +++ b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch | |||
24 | @@ -512,7 +512,7 @@ index 0000000..bcd73b9 | |||
25 | 512 | + | 512 | + |
26 | 513 | +#endif /* __NAUTILUS_SEARCH_ENGINE_RECENT_H__ */ | 513 | +#endif /* __NAUTILUS_SEARCH_ENGINE_RECENT_H__ */ |
27 | 514 | diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c | 514 | diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c |
29 | 515 | index 3a0c9d4..793b831 100644 | 515 | index 28863f7..a4c6007 100644 |
30 | 516 | --- a/src/nautilus-search-engine.c | 516 | --- a/src/nautilus-search-engine.c |
31 | 517 | +++ b/src/nautilus-search-engine.c | 517 | +++ b/src/nautilus-search-engine.c |
32 | 518 | @@ -30,11 +30,13 @@ | 518 | @@ -30,11 +30,13 @@ |
33 | diff --git a/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch b/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch | |||
34 | index e6185da..ad248da 100644 | |||
35 | --- a/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch | |||
36 | +++ b/debian/patches/0017-recent-add-function-to-update-manager-on-file-rename.patch | |||
37 | @@ -49,7 +49,7 @@ index 19316e8..9bb5460 100644 | |||
38 | 49 | 49 | ||
39 | 50 | /* Now send out the changed and added signals for existing file objects. */ | 50 | /* Now send out the changed and added signals for existing file objects. */ |
40 | 51 | diff --git a/src/nautilus-file.c b/src/nautilus-file.c | 51 | diff --git a/src/nautilus-file.c b/src/nautilus-file.c |
42 | 52 | index 63413a6..9416214 100644 | 52 | index 28b5a13..7886d1f 100644 |
43 | 53 | --- a/src/nautilus-file.c | 53 | --- a/src/nautilus-file.c |
44 | 54 | +++ b/src/nautilus-file.c | 54 | +++ b/src/nautilus-file.c |
45 | 55 | @@ -34,6 +34,7 @@ | 55 | @@ -34,6 +34,7 @@ |
46 | diff --git a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch | |||
47 | index 91a7ec0..158b448 100644 | |||
48 | --- a/debian/patches/0018-search-engine-add-locate-based-search-engine.patch | |||
49 | +++ b/debian/patches/0018-search-engine-add-locate-based-search-engine.patch | |||
50 | @@ -678,7 +678,7 @@ index 0000000..ac5e3fc | |||
51 | 678 | + | 678 | + |
52 | 679 | +#endif /* __NAUTILUS_SEARCH_ENGINE_LOCATE_H__ */ | 679 | +#endif /* __NAUTILUS_SEARCH_ENGINE_LOCATE_H__ */ |
53 | 680 | diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c | 680 | diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c |
55 | 681 | index 793b831..902d483 100644 | 681 | index a4c6007..475a432 100644 |
56 | 682 | --- a/src/nautilus-search-engine.c | 682 | --- a/src/nautilus-search-engine.c |
57 | 683 | +++ b/src/nautilus-search-engine.c | 683 | +++ b/src/nautilus-search-engine.c |
58 | 684 | @@ -29,6 +29,7 @@ | 684 | @@ -29,6 +29,7 @@ |
59 | diff --git a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch | |||
60 | index fddae3e..3c89693 100644 | |||
61 | --- a/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch | |||
62 | +++ b/debian/patches/query-add-recursive-flags-and-use-it-in-search-engines.patch | |||
63 | @@ -198,7 +198,7 @@ index b567611..b165d63 100644 | |||
64 | 198 | + | 198 | + |
65 | 199 | #endif /* NAUTILUS_FILE_UTILITIES_H */ | 199 | #endif /* NAUTILUS_FILE_UTILITIES_H */ |
66 | 200 | diff --git a/src/nautilus-file.c b/src/nautilus-file.c | 200 | diff --git a/src/nautilus-file.c b/src/nautilus-file.c |
68 | 201 | index 3f6a69f..63413a6 100644 | 201 | index 22ea199..e30d791 100644 |
69 | 202 | --- a/src/nautilus-file.c | 202 | --- a/src/nautilus-file.c |
70 | 203 | +++ b/src/nautilus-file.c | 203 | +++ b/src/nautilus-file.c |
71 | 204 | @@ -4975,6 +4975,29 @@ nautilus_file_get_filesystem_type (NautilusFile *file) | 204 | @@ -4975,6 +4975,29 @@ nautilus_file_get_filesystem_type (NautilusFile *file) |
72 | diff --git a/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch b/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch | |||
73 | 205 | new file mode 100644 | 205 | new file mode 100644 |
74 | index 0000000..1b7f874 | |||
75 | --- /dev/null | |||
76 | +++ b/debian/patches/search-engine-Query-file-system-to-determine-remoteness.patch | |||
77 | @@ -0,0 +1,127 @@ | |||
78 | 1 | From: Ernestas Kulik <ernestask@gnome.org> | ||
79 | 2 | Date: Fri, 14 Sep 2018 12:52:11 +0200 | ||
80 | 3 | Subject: search-engine: Query file system to determine remoteness | ||
81 | 4 | |||
82 | 5 | Querying the file cache in is_recursive_search() does not guarantee that | ||
83 | 6 | the file system field will be populated with a value, and somehow | ||
84 | 7 | results in data races, in turn resulting in random crashes/file list | ||
85 | 8 | corruption. | ||
86 | 9 | |||
87 | 10 | Hopefully fixes https://gitlab.gnome.org/GNOME/nautilus/issues/640, | ||
88 | 11 | closes https://gitlab.gnome.org/GNOME/nautilus/issues/632 and resolves | ||
89 | 12 | https://gitlab.gnome.org/GNOME/nautilus/issues/602 | ||
90 | 13 | |||
91 | 14 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1795028 | ||
92 | 15 | Applied-Upstream: yes, 3.30.1, https://gitlab.gnome.org/GNOME/nautilus/commit/62ba6d83d | ||
93 | 16 | --- | ||
94 | 17 | src/nautilus-file-utilities.c | 18 ++++++++++++++++++ | ||
95 | 18 | src/nautilus-file-utilities.h | 2 ++ | ||
96 | 19 | src/nautilus-file.c | 14 +------------- | ||
97 | 20 | src/nautilus-search-engine.c | 18 +++++++++++++++--- | ||
98 | 21 | 4 files changed, 36 insertions(+), 16 deletions(-) | ||
99 | 22 | |||
100 | 23 | diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c | ||
101 | 24 | index f8d8476..3e363a4 100644 | ||
102 | 25 | --- a/src/nautilus-file-utilities.c | ||
103 | 26 | +++ b/src/nautilus-file-utilities.c | ||
104 | 27 | @@ -1565,3 +1565,21 @@ location_settings_search_get_recursive_for_location (GFile *location) | ||
105 | 28 | |||
106 | 29 | return recursive; | ||
107 | 30 | } | ||
108 | 31 | + | ||
109 | 32 | +gboolean | ||
110 | 33 | +nautilus_file_system_is_remote (const char *file_system) | ||
111 | 34 | +{ | ||
112 | 35 | + static const gchar * const remote_types[] = | ||
113 | 36 | + { | ||
114 | 37 | + "afp", | ||
115 | 38 | + "google-drive", | ||
116 | 39 | + "sftp", | ||
117 | 40 | + "webdav", | ||
118 | 41 | + "ftp", | ||
119 | 42 | + "nfs", | ||
120 | 43 | + "cifs", | ||
121 | 44 | + NULL | ||
122 | 45 | + }; | ||
123 | 46 | + | ||
124 | 47 | + return file_system != NULL && g_strv_contains (remote_types, file_system); | ||
125 | 48 | +} | ||
126 | 49 | diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h | ||
127 | 50 | index b165d63..37f7f49 100644 | ||
128 | 51 | --- a/src/nautilus-file-utilities.h | ||
129 | 52 | +++ b/src/nautilus-file-utilities.h | ||
130 | 53 | @@ -133,4 +133,6 @@ gchar * nautilus_uri_to_native_uri (const gchar *uri); | ||
131 | 54 | NautilusQueryRecursive location_settings_search_get_recursive (void); | ||
132 | 55 | NautilusQueryRecursive location_settings_search_get_recursive_for_location (GFile *location); | ||
133 | 56 | |||
134 | 57 | +gboolean nautilus_file_system_is_remote (const char *file_system); | ||
135 | 58 | + | ||
136 | 59 | #endif /* NAUTILUS_FILE_UTILITIES_H */ | ||
137 | 60 | diff --git a/src/nautilus-file.c b/src/nautilus-file.c | ||
138 | 61 | index e30d791..28b5a13 100644 | ||
139 | 62 | --- a/src/nautilus-file.c | ||
140 | 63 | +++ b/src/nautilus-file.c | ||
141 | 64 | @@ -8371,18 +8371,6 @@ nautilus_file_is_in_recent (NautilusFile *file) | ||
142 | 65 | return nautilus_directory_is_in_recent (file->details->directory); | ||
143 | 66 | } | ||
144 | 67 | |||
145 | 68 | -static const gchar * const remote_types[] = | ||
146 | 69 | -{ | ||
147 | 70 | - "afp", | ||
148 | 71 | - "google-drive", | ||
149 | 72 | - "sftp", | ||
150 | 73 | - "webdav", | ||
151 | 74 | - "ftp", | ||
152 | 75 | - "nfs", | ||
153 | 76 | - "cifs", | ||
154 | 77 | - NULL | ||
155 | 78 | -}; | ||
156 | 79 | - | ||
157 | 80 | /** | ||
158 | 81 | * nautilus_file_is_remote | ||
159 | 82 | * | ||
160 | 83 | @@ -8406,7 +8394,7 @@ nautilus_file_is_remote (NautilusFile *file) | ||
161 | 84 | |||
162 | 85 | filesystem_type = nautilus_file_get_filesystem_type (file); | ||
163 | 86 | |||
164 | 87 | - return filesystem_type != NULL && g_strv_contains (remote_types, filesystem_type); | ||
165 | 88 | + return nautilus_file_system_is_remote (filesystem_type); | ||
166 | 89 | } | ||
167 | 90 | |||
168 | 91 | /** | ||
169 | 92 | diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c | ||
170 | 93 | index 3a0c9d4..28863f7 100644 | ||
171 | 94 | --- a/src/nautilus-search-engine.c | ||
172 | 95 | +++ b/src/nautilus-search-engine.c | ||
173 | 96 | @@ -23,7 +23,7 @@ | ||
174 | 97 | #include "nautilus-search-engine.h" | ||
175 | 98 | #include "nautilus-search-engine-private.h" | ||
176 | 99 | |||
177 | 100 | -#include "nautilus-file.h" | ||
178 | 101 | +#include "nautilus-file-utilities.h" | ||
179 | 102 | #include "nautilus-search-engine-model.h" | ||
180 | 103 | #include "nautilus-search-provider.h" | ||
181 | 104 | #include <glib/gi18n.h> | ||
182 | 105 | @@ -437,8 +437,20 @@ is_recursive_search (NautilusSearchEngineType engine_type, | ||
183 | 106 | |||
184 | 107 | case NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY: | ||
185 | 108 | { | ||
186 | 109 | - g_autoptr (NautilusFile) file = nautilus_file_get (location); | ||
187 | 110 | - return !nautilus_file_is_remote (file); | ||
188 | 111 | + g_autoptr (GFileInfo) file_system_info = NULL; | ||
189 | 112 | + | ||
190 | 113 | + file_system_info = g_file_query_filesystem_info (location, | ||
191 | 114 | + G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, | ||
192 | 115 | + NULL, NULL); | ||
193 | 116 | + if (file_system_info != NULL) | ||
194 | 117 | + { | ||
195 | 118 | + const char *file_system; | ||
196 | 119 | + | ||
197 | 120 | + file_system = g_file_info_get_attribute_string (file_system_info, | ||
198 | 121 | + G_FILE_ATTRIBUTE_FILESYSTEM_TYPE); | ||
199 | 122 | + | ||
200 | 123 | + return !nautilus_file_system_is_remote (file_system); | ||
201 | 124 | + } | ||
202 | 125 | } | ||
203 | 126 | } | ||
204 | 127 | |||
205 | diff --git a/debian/patches/series b/debian/patches/series | |||
206 | index 61d3d3a..2942ff8 100644 | |||
207 | --- a/debian/patches/series | |||
208 | +++ b/debian/patches/series | |||
209 | @@ -17,6 +17,7 @@ ubuntu_backspace_behaviour.patch | |||
210 | 17 | #Needs updating | 17 | #Needs updating |
211 | 18 | #16_unity_new_documents.patch | 18 | #16_unity_new_documents.patch |
212 | 19 | query-add-recursive-flags-and-use-it-in-search-engines.patch | 19 | query-add-recursive-flags-and-use-it-in-search-engines.patch |
213 | 20 | search-engine-Query-file-system-to-determine-remoteness.patch | ||
214 | 20 | 0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch | 21 | 0015-tracker-search-engine-don-t-start-it-if-not-availabl.patch |
215 | 21 | 0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch | 22 | 0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch |
216 | 22 | 0017-recent-add-function-to-update-manager-on-file-rename.patch | 23 | 0017-recent-add-function-to-update-manager-on-file-rename.patch |
217 | @@ -24,4 +25,3 @@ query-add-recursive-flags-and-use-it-in-search-engines.patch | |||
218 | 24 | appstream-compulsory.patch | 25 | appstream-compulsory.patch |
219 | 25 | nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch | 26 | nautilusgtkplacesview-show-error-if-volume-is-not-mo.patch |
220 | 26 | file-view-Always-unset-pending_selection-after-freeing-it.patch | 27 | file-view-Always-unset-pending_selection-after-freeing-it.patch |
221 | 27 | ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch | ||
222 | diff --git a/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch b/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch | |||
223 | 28 | deleted file mode 100644 | 28 | deleted file mode 100644 |
224 | index ca55544..0000000 | |||
225 | --- a/debian/patches/ubuntu/shell-search-provider-implement-XUbuntuCancel-to-request-.patch | |||
226 | +++ /dev/null | |||
227 | @@ -1,212 +0,0 @@ | |||
228 | 1 | From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> | ||
229 | 2 | Date: Tue, 28 Aug 2018 01:44:49 +0200 | ||
230 | 3 | Subject: shell-search-provider: implement XUbuntuCancel to request search cancellation | ||
231 | 4 | |||
232 | 5 | Stop search and Metadata fetching on XUbuntuCancel dbus method call. | ||
233 | 6 | Only allow this if the caller is the same who triggered the actual event. | ||
234 | 7 | |||
235 | 8 | Bug-GNOME: https://gitlab.gnome.org/GNOME/gnome-shell/issues/183 | ||
236 | 9 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/nautilus/+bug/1756826 | ||
237 | 10 | Forwarded: not-needed | ||
238 | 11 | --- | ||
239 | 12 | data/shell-search-provider-dbus-interfaces.xml | 1 + | ||
240 | 13 | src/nautilus-shell-search-provider.c | 96 +++++++++++++++++++++++--- | ||
241 | 14 | 2 files changed, 88 insertions(+), 9 deletions(-) | ||
242 | 15 | |||
243 | 16 | diff --git a/data/shell-search-provider-dbus-interfaces.xml b/data/shell-search-provider-dbus-interfaces.xml | ||
244 | 17 | index f6840e2..4529c1e 100644 | ||
245 | 18 | --- a/data/shell-search-provider-dbus-interfaces.xml | ||
246 | 19 | +++ b/data/shell-search-provider-dbus-interfaces.xml | ||
247 | 20 | @@ -40,5 +40,6 @@ | ||
248 | 21 | <arg type='as' name='Terms' direction='in' /> | ||
249 | 22 | <arg type='u' name='Timestamp' direction='in' /> | ||
250 | 23 | </method> | ||
251 | 24 | + <method name = 'XUbuntuCancel' /> | ||
252 | 25 | </interface> | ||
253 | 26 | </node> | ||
254 | 27 | diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c | ||
255 | 28 | index ffc2b7f..58864d6 100644 | ||
256 | 29 | --- a/src/nautilus-shell-search-provider.c | ||
257 | 30 | +++ b/src/nautilus-shell-search-provider.c | ||
258 | 31 | @@ -60,6 +60,7 @@ struct _NautilusShellSearchProvider | ||
259 | 32 | |||
260 | 33 | PendingSearch *current_search; | ||
261 | 34 | |||
262 | 35 | + GList *metas_requests; | ||
263 | 36 | GHashTable *metas_cache; | ||
264 | 37 | }; | ||
265 | 38 | |||
266 | 39 | @@ -143,11 +144,25 @@ pending_search_finish (PendingSearch *search, | ||
267 | 40 | } | ||
268 | 41 | |||
269 | 42 | static void | ||
270 | 43 | -cancel_current_search (NautilusShellSearchProvider *self) | ||
271 | 44 | +cancel_current_search (NautilusShellSearchProvider *self, | ||
272 | 45 | + gboolean ignore_partial_results) | ||
273 | 46 | { | ||
274 | 47 | - if (self->current_search != NULL) | ||
275 | 48 | + PendingSearch *search = self->current_search; | ||
276 | 49 | + | ||
277 | 50 | + if (search != NULL) | ||
278 | 51 | { | ||
279 | 52 | - nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (self->current_search->engine)); | ||
280 | 53 | + g_debug ("*** Cancel current search"); | ||
281 | 54 | + | ||
282 | 55 | + nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (search->engine)); | ||
283 | 56 | + | ||
284 | 57 | + if (ignore_partial_results) | ||
285 | 58 | + { | ||
286 | 59 | + g_signal_handlers_disconnect_by_data (G_OBJECT (search->engine), | ||
287 | 60 | + search); | ||
288 | 61 | + | ||
289 | 62 | + pending_search_finish (search, search->invocation, | ||
290 | 63 | + g_variant_new ("(as)", NULL)); | ||
291 | 64 | + } | ||
292 | 65 | } | ||
293 | 66 | } | ||
294 | 67 | |||
295 | 68 | @@ -451,7 +466,7 @@ execute_search (NautilusShellSearchProvider *self, | ||
296 | 69 | NautilusQuery *query; | ||
297 | 70 | PendingSearch *pending_search; | ||
298 | 71 | |||
299 | 72 | - cancel_current_search (self); | ||
300 | 73 | + cancel_current_search (self, FALSE); | ||
301 | 74 | |||
302 | 75 | /* don't attempt searches for a single character */ | ||
303 | 76 | if (g_strv_length (terms) == 1 && | ||
304 | 77 | @@ -524,6 +539,7 @@ typedef struct | ||
305 | 78 | NautilusShellSearchProvider *self; | ||
306 | 79 | |||
307 | 80 | gint64 start_time; | ||
308 | 81 | + NautilusFileListHandle *handle; | ||
309 | 82 | GDBusMethodInvocation *invocation; | ||
310 | 83 | |||
311 | 84 | gchar **uris; | ||
312 | 85 | @@ -532,6 +548,8 @@ typedef struct | ||
313 | 86 | static void | ||
314 | 87 | result_metas_data_free (ResultMetasData *data) | ||
315 | 88 | { | ||
316 | 89 | + g_clear_pointer (&data->handle, nautilus_file_list_cancel_call_when_ready); | ||
317 | 90 | + | ||
318 | 91 | g_clear_object (&data->self); | ||
319 | 92 | g_clear_object (&data->invocation); | ||
320 | 93 | g_strfreev (data->uris); | ||
321 | 94 | @@ -549,7 +567,7 @@ result_metas_return_from_cache (ResultMetasData *data) | ||
322 | 95 | |||
323 | 96 | g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}")); | ||
324 | 97 | |||
325 | 98 | - for (idx = 0; data->uris[idx] != NULL; idx++) | ||
326 | 99 | + for (idx = 0; data->uris && data->uris[idx] != NULL; idx++) | ||
327 | 100 | { | ||
328 | 101 | meta = g_hash_table_lookup (data->self->metas_cache, | ||
329 | 102 | data->uris[idx]); | ||
330 | 103 | @@ -564,6 +582,37 @@ result_metas_return_from_cache (ResultMetasData *data) | ||
331 | 104 | g_variant_new ("(aa{sv})", &builder)); | ||
332 | 105 | } | ||
333 | 106 | |||
334 | 107 | +static void | ||
335 | 108 | +cancel_result_meta_requests (NautilusShellSearchProvider *self, | ||
336 | 109 | + GDBusMethodInvocation *invocation) | ||
337 | 110 | +{ | ||
338 | 111 | + GList *l; | ||
339 | 112 | + GList *to_remove = NULL; | ||
340 | 113 | + | ||
341 | 114 | + g_debug ("*** Cancel Results Meta requests"); | ||
342 | 115 | + | ||
343 | 116 | + for (l = self->metas_requests; l; l = l->next) | ||
344 | 117 | + { | ||
345 | 118 | + ResultMetasData *data = l->data; | ||
346 | 119 | + | ||
347 | 120 | + if (invocation == NULL || | ||
348 | 121 | + g_strcmp0 (g_dbus_method_invocation_get_sender (data->invocation), | ||
349 | 122 | + g_dbus_method_invocation_get_sender (invocation)) == 0) | ||
350 | 123 | + { | ||
351 | 124 | + g_clear_pointer (&data->uris, g_strfreev); | ||
352 | 125 | + result_metas_return_from_cache (data); | ||
353 | 126 | + to_remove = g_list_prepend (to_remove, data); | ||
354 | 127 | + } | ||
355 | 128 | + } | ||
356 | 129 | + | ||
357 | 130 | + for (l = to_remove; l; l = l->next) | ||
358 | 131 | + { | ||
359 | 132 | + self->metas_requests = g_list_remove (self->metas_requests, l->data); | ||
360 | 133 | + } | ||
361 | 134 | + | ||
362 | 135 | + g_list_free (to_remove); | ||
363 | 136 | +} | ||
364 | 137 | + | ||
365 | 138 | static void | ||
366 | 139 | result_list_attributes_ready_cb (GList *file_list, | ||
367 | 140 | gpointer user_data) | ||
368 | 141 | @@ -639,6 +688,9 @@ result_list_attributes_ready_cb (GList *file_list, | ||
369 | 142 | g_free (uri); | ||
370 | 143 | } | ||
371 | 144 | |||
372 | 145 | + data->handle = NULL; | ||
373 | 146 | + data->self->metas_requests = g_list_remove (data->self->metas_requests, data); | ||
374 | 147 | + | ||
375 | 148 | result_metas_return_from_cache (data); | ||
376 | 149 | result_metas_data_free (data); | ||
377 | 150 | } | ||
378 | 151 | @@ -682,9 +734,10 @@ handle_get_result_metas (NautilusShellSearchProvider2 *skeleton, | ||
379 | 152 | |||
380 | 153 | nautilus_file_list_call_when_ready (missing_files, | ||
381 | 154 | NAUTILUS_FILE_ATTRIBUTES_FOR_ICON, | ||
382 | 155 | - NULL, | ||
383 | 156 | + &data->handle, | ||
384 | 157 | result_list_attributes_ready_cb, | ||
385 | 158 | data); | ||
386 | 159 | + self->metas_requests = g_list_prepend (self->metas_requests, data); | ||
387 | 160 | nautilus_file_list_free (missing_files); | ||
388 | 161 | return TRUE; | ||
389 | 162 | } | ||
390 | 163 | @@ -743,14 +796,37 @@ handle_launch_search (NautilusShellSearchProvider2 *skeleton, | ||
391 | 164 | return TRUE; | ||
392 | 165 | } | ||
393 | 166 | |||
394 | 167 | -static void | ||
395 | 168 | -search_provider_dispose (GObject *obj) | ||
396 | 169 | +static gboolean | ||
397 | 170 | +handle_xubuntu_cancel (NautilusShellSearchProvider2 *skeleton, | ||
398 | 171 | + GDBusMethodInvocation *invocation, | ||
399 | 172 | + gpointer user_data) | ||
400 | 173 | { | ||
401 | 174 | + NautilusShellSearchProvider *self = user_data; | ||
402 | 175 | + PendingSearch *search = self->current_search; | ||
403 | 176 | + | ||
404 | 177 | + g_debug ("*** XUbuntuCancel called"); | ||
405 | 178 | + | ||
406 | 179 | + if (search != NULL && | ||
407 | 180 | + g_strcmp0 (g_dbus_method_invocation_get_sender (search->invocation), | ||
408 | 181 | + g_dbus_method_invocation_get_sender (invocation)) == 0) | ||
409 | 182 | + { | ||
410 | 183 | + cancel_current_search (self, TRUE); | ||
411 | 184 | + } | ||
412 | 185 | + | ||
413 | 186 | + cancel_result_meta_requests (self, invocation); | ||
414 | 187 | + | ||
415 | 188 | + nautilus_shell_search_provider2_complete_xubuntu_cancel (skeleton, invocation); | ||
416 | 189 | + | ||
417 | 190 | + return TRUE; | ||
418 | 191 | +} | ||
419 | 192 | + | ||
420 | 193 | + static void search_provider_dispose(GObject * obj) { | ||
421 | 194 | NautilusShellSearchProvider *self = NAUTILUS_SHELL_SEARCH_PROVIDER (obj); | ||
422 | 195 | |||
423 | 196 | g_clear_object (&self->skeleton); | ||
424 | 197 | g_hash_table_destroy (self->metas_cache); | ||
425 | 198 | - cancel_current_search (self); | ||
426 | 199 | + cancel_current_search (self, TRUE); | ||
427 | 200 | + cancel_result_meta_requests (self, NULL); | ||
428 | 201 | |||
429 | 202 | G_OBJECT_CLASS (nautilus_shell_search_provider_parent_class)->dispose (obj); | ||
430 | 203 | } | ||
431 | 204 | @@ -773,6 +849,8 @@ nautilus_shell_search_provider_init (NautilusShellSearchProvider *self) | ||
432 | 205 | G_CALLBACK (handle_activate_result), self); | ||
433 | 206 | g_signal_connect (self->skeleton, "handle-launch-search", | ||
434 | 207 | G_CALLBACK (handle_launch_search), self); | ||
435 | 208 | + g_signal_connect (self->skeleton, "handle-xubuntu-cancel", | ||
436 | 209 | + G_CALLBACK (handle_xubuntu_cancel), self); | ||
437 | 210 | } | ||
438 | 211 | |||
439 | 212 | static void |