Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-recent-search-memory-fixes into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic

Proposed by Marco Trevisan (Treviño) on 2018-10-04
Status: Merged
Merged at revision: c5e96f68f9dbd3c9c67cbc387a17c1ae7381045a
Proposed branch: ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-recent-search-memory-fixes
Merge into: ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/bionic
Prerequisite: ~3v1n0/ubuntu/+source/nautilus:ubuntu/bionic-fix-file-remote-type-search-crash
Diff against target: 175 lines (+42/-26)
2 files modified
debian/changelog (+4/-2)
debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch (+38/-24)
Reviewer Review Type Date Requested Status
Sebastien Bacher 2018-10-04 Approve on 2018-10-08
Review via email: mp+356149@code.launchpad.net
To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

looks fine, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index a57b726..3c05fb6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,11 @@
1nautilus (1:3.26.4-0~ubuntu18.04.2) UNRELEASED; urgency=medium1nautilus (1:3.26.4-0~ubuntu18.04.2) bionic urgency=medium
22
3 * d/p/search-engine-Query-file-system-to-determine-remoteness.patch:3 * d/p/search-engine-Query-file-system-to-determine-remoteness.patch:
4 - Fix remote filesystem check on file during search (LP: #1795028)4 - Fix remote filesystem check on file during search (LP: #1795028)
5 * d/p/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch:
6 - Refreshed to add memory leak and potential crash fixes
57
6 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 05 Sep 2018 18:03:14 +02008 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 04 Oct 2018 19:46:19 +0200
79
8nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium10nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium
911
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
index 20e597c..d2c1db5 100644
--- 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
@@ -13,13 +13,14 @@ simple engine will be already fast enough, while running this engine could be
13just a waste.13just a waste.
1414
15Origin: upstream15Origin: upstream
16Applied-Upstream: https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e616Applied-Upstream: 3.30.0, https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
17Forwarded: yes, https://gitlab.gnome.org/GNOME/nautilus/merge_requests/323
17---18---
18 src/meson.build | 2 +19 src/meson.build | 2 +
19 src/nautilus-search-engine-recent.c | 427 ++++++++++++++++++++++++++++++++++++20 src/nautilus-search-engine-recent.c | 440 ++++++++++++++++++++++++++++++++++++
20 src/nautilus-search-engine-recent.h | 36 +++21 src/nautilus-search-engine-recent.h | 36 +++
21 src/nautilus-search-engine.c | 11 +22 src/nautilus-search-engine.c | 11 +
22 4 files changed, 476 insertions(+)23 4 files changed, 489 insertions(+)
23 create mode 100644 src/nautilus-search-engine-recent.c24 create mode 100644 src/nautilus-search-engine-recent.c
24 create mode 100644 src/nautilus-search-engine-recent.h25 create mode 100644 src/nautilus-search-engine-recent.h
2526
@@ -38,10 +39,10 @@ index 73aafe9..213b35f 100644
38 'nautilus-search-hit.c',39 'nautilus-search-hit.c',
39diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c40diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c
40new file mode 10064441new file mode 100644
41index 0000000..bbd0d8242index 0000000..bdd130d
42--- /dev/null43--- /dev/null
43+++ b/src/nautilus-search-engine-recent.c44+++ b/src/nautilus-search-engine-recent.c
44@@ -0,0 +1,427 @@45@@ -0,0 +1,440 @@
45+/*46+/*
46+ * Copyright (C) 2018 Canonical Ltd47+ * Copyright (C) 2018 Canonical Ltd
47+ *48+ *
@@ -86,6 +87,7 @@ index 0000000..bbd0d82
86+ NautilusQuery *query;87+ NautilusQuery *query;
87+ GCancellable *cancellable;88+ GCancellable *cancellable;
88+ GtkRecentManager *recent_manager;89+ GtkRecentManager *recent_manager;
90+ guint add_hits_idle_id;
89+};91+};
90+92+
91+static void nautilus_search_provider_init (NautilusSearchProviderInterface *iface);93+static void nautilus_search_provider_init (NautilusSearchProviderInterface *iface);
@@ -115,11 +117,13 @@ index 0000000..bbd0d82
115+{117+{
116+ NautilusSearchEngineRecent *self = NAUTILUS_SEARCH_ENGINE_RECENT (object);118+ NautilusSearchEngineRecent *self = NAUTILUS_SEARCH_ENGINE_RECENT (object);
117+119+
118+ if (self->cancellable)120+ if (self->add_hits_idle_id != 0)
119+ {121+ {
120+ g_cancellable_cancel (self->cancellable);122+ g_source_remove (self->add_hits_idle_id);
121+ }123+ }
122+124+
125+ g_cancellable_cancel (self->cancellable);
126+
123+ g_clear_object (&self->query);127+ g_clear_object (&self->query);
124+ g_clear_object (&self->cancellable);128+ g_clear_object (&self->cancellable);
125+129+
@@ -140,6 +144,8 @@ index 0000000..bbd0d82
140+ NautilusSearchEngineRecent *self = search_hits->recent;144+ NautilusSearchEngineRecent *self = search_hits->recent;
141+ NautilusSearchProvider *provider = NAUTILUS_SEARCH_PROVIDER (self);145+ NautilusSearchProvider *provider = NAUTILUS_SEARCH_PROVIDER (self);
142+146+
147+ self->add_hits_idle_id = 0;
148+
143+ if (!g_cancellable_is_cancelled (self->cancellable))149+ if (!g_cancellable_is_cancelled (self->cancellable))
144+ {150+ {
145+ nautilus_search_provider_hits_added (provider, search_hits->hits);151+ nautilus_search_provider_hits_added (provider, search_hits->hits);
@@ -147,18 +153,36 @@ index 0000000..bbd0d82
147+ }153+ }
148+154+
149+ g_list_free_full (search_hits->hits, g_object_unref);155+ g_list_free_full (search_hits->hits, g_object_unref);
150+ g_object_unref (self->query);
151+ g_clear_object (&self->cancellable);156+ g_clear_object (&self->cancellable);
152+ g_object_unref (self);
153+ g_free (search_hits);157+ g_free (search_hits);
154+158+
155+ nautilus_search_provider_finished (provider,159+ nautilus_search_provider_finished (provider,
156+ NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL);160+ NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL);
157+ g_object_notify (G_OBJECT (provider), "running");161+ g_object_notify (G_OBJECT (provider), "running");
158+162+
163+ g_object_unref (self);
164+
159+ return FALSE;165+ return FALSE;
160+}166+}
161+167+
168+static void
169+search_add_hits_idle (NautilusSearchEngineRecent *self,
170+ GList *hits)
171+{
172+ SearchHitsData *search_hits;
173+
174+ if (self->add_hits_idle_id != 0)
175+ {
176+ return;
177+ }
178+
179+ search_hits = g_new0 (SearchHitsData, 1);
180+ search_hits->recent = self;
181+ search_hits->hits = hits;
182+
183+ self->add_hits_idle_id = g_idle_add (search_thread_add_hits_idle, search_hits);
184+}
185+
162+static gboolean186+static gboolean
163+is_file_valid_recursive (NautilusSearchEngineRecent *self,187+is_file_valid_recursive (NautilusSearchEngineRecent *self,
164+ GFile *file,188+ GFile *file,
@@ -272,8 +296,8 @@ index 0000000..bbd0d82
272+296+
273+ if (rank <= 0)297+ if (rank <= 0)
274+ {298+ {
275+ name = gtk_recent_info_get_short_name (info);299+ g_autofree char *short_name = gtk_recent_info_get_short_name (info);
276+ rank = nautilus_query_matches_string (self->query, name);300+ rank = nautilus_query_matches_string (self->query, short_name);
277+ }301+ }
278+302+
279+ if (rank > 0)303+ if (rank > 0)
@@ -340,11 +364,7 @@ index 0000000..bbd0d82
340+ }364+ }
341+ }365+ }
342+366+
343+ search_hits = g_new0 (SearchHitsData, 1);367+ search_add_hits_idle (self, hits);
344+ search_hits->recent = self;
345+ search_hits->hits = hits;
346+
347+ g_idle_add (search_thread_add_hits_idle, search_hits);
348+368+
349+ g_list_free_full (recent_items, (GDestroyNotify) gtk_recent_info_unref);369+ g_list_free_full (recent_items, (GDestroyNotify) gtk_recent_info_unref);
350+ g_list_free_full (mime_types, g_free);370+ g_list_free_full (mime_types, g_free);
@@ -362,23 +382,17 @@ index 0000000..bbd0d82
362+ g_return_if_fail (self->query);382+ g_return_if_fail (self->query);
363+ g_return_if_fail (self->cancellable == NULL);383+ g_return_if_fail (self->cancellable == NULL);
364+384+
365+ g_object_ref (self);
366+ g_object_ref (self->query);
367+
368+ location = nautilus_query_get_location (self->query);385+ location = nautilus_query_get_location (self->query);
369+386+
370+ if (!is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,387+ if (!is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,
371+ nautilus_query_get_recursive (self->query),388+ nautilus_query_get_recursive (self->query),
372+ location))389+ location))
373+ {390+ {
374+ SearchHitsData *search_hits;391+ search_add_hits_idle (self, NULL);
375+ search_hits = g_new0 (SearchHitsData, 1);
376+ search_hits->recent = self;
377+
378+ g_idle_add (search_thread_add_hits_idle, search_hits);
379+ return;392+ return;
380+ }393+ }
381+394+
395+ g_object_ref (self);
382+ self->cancellable = g_cancellable_new ();396+ self->cancellable = g_cancellable_new ();
383+397+
384+ thread = g_thread_new ("nautilus-search-recent", recent_thread_func, self);398+ thread = g_thread_new ("nautilus-search-recent", recent_thread_func, self);

Subscribers

People subscribed via source and target branches