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)
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 Approve
Review via email: mp+356149@code.launchpad.net
To post a comment you must log in.
Revision history for this message
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
1diff --git a/debian/changelog b/debian/changelog
2index a57b726..3c05fb6 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,9 +1,11 @@
6-nautilus (1:3.26.4-0~ubuntu18.04.2) UNRELEASED; urgency=medium
7+nautilus (1:3.26.4-0~ubuntu18.04.2) bionic urgency=medium
8
9 * d/p/search-engine-Query-file-system-to-determine-remoteness.patch:
10 - Fix remote filesystem check on file during search (LP: #1795028)
11+ * d/p/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch:
12+ - Refreshed to add memory leak and potential crash fixes
13
14- -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 05 Sep 2018 18:03:14 +0200
15+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 04 Oct 2018 19:46:19 +0200
16
17 nautilus (1:3.26.4-0~ubuntu18.04.1) bionic; urgency=medium
18
19diff --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
20index 20e597c..d2c1db5 100644
21--- a/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
22+++ b/debian/patches/0016-search-engine-add-a-recent-search-engine-listing-Gtk.patch
23@@ -13,13 +13,14 @@ simple engine will be already fast enough, while running this engine could be
24 just a waste.
25
26 Origin: upstream
27-Applied-Upstream: https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
28+Applied-Upstream: 3.30.0, https://gitlab.gnome.org/GNOME/nautilus/commit/69686372fd6e6
29+Forwarded: yes, https://gitlab.gnome.org/GNOME/nautilus/merge_requests/323
30 ---
31 src/meson.build | 2 +
32- src/nautilus-search-engine-recent.c | 427 ++++++++++++++++++++++++++++++++++++
33+ src/nautilus-search-engine-recent.c | 440 ++++++++++++++++++++++++++++++++++++
34 src/nautilus-search-engine-recent.h | 36 +++
35 src/nautilus-search-engine.c | 11 +
36- 4 files changed, 476 insertions(+)
37+ 4 files changed, 489 insertions(+)
38 create mode 100644 src/nautilus-search-engine-recent.c
39 create mode 100644 src/nautilus-search-engine-recent.h
40
41@@ -38,10 +39,10 @@ index 73aafe9..213b35f 100644
42 'nautilus-search-hit.c',
43 diff --git a/src/nautilus-search-engine-recent.c b/src/nautilus-search-engine-recent.c
44 new file mode 100644
45-index 0000000..bbd0d82
46+index 0000000..bdd130d
47 --- /dev/null
48 +++ b/src/nautilus-search-engine-recent.c
49-@@ -0,0 +1,427 @@
50+@@ -0,0 +1,440 @@
51 +/*
52 + * Copyright (C) 2018 Canonical Ltd
53 + *
54@@ -86,6 +87,7 @@ index 0000000..bbd0d82
55 + NautilusQuery *query;
56 + GCancellable *cancellable;
57 + GtkRecentManager *recent_manager;
58++ guint add_hits_idle_id;
59 +};
60 +
61 +static void nautilus_search_provider_init (NautilusSearchProviderInterface *iface);
62@@ -115,11 +117,13 @@ index 0000000..bbd0d82
63 +{
64 + NautilusSearchEngineRecent *self = NAUTILUS_SEARCH_ENGINE_RECENT (object);
65 +
66-+ if (self->cancellable)
67++ if (self->add_hits_idle_id != 0)
68 + {
69-+ g_cancellable_cancel (self->cancellable);
70++ g_source_remove (self->add_hits_idle_id);
71 + }
72 +
73++ g_cancellable_cancel (self->cancellable);
74++
75 + g_clear_object (&self->query);
76 + g_clear_object (&self->cancellable);
77 +
78@@ -140,6 +144,8 @@ index 0000000..bbd0d82
79 + NautilusSearchEngineRecent *self = search_hits->recent;
80 + NautilusSearchProvider *provider = NAUTILUS_SEARCH_PROVIDER (self);
81 +
82++ self->add_hits_idle_id = 0;
83++
84 + if (!g_cancellable_is_cancelled (self->cancellable))
85 + {
86 + nautilus_search_provider_hits_added (provider, search_hits->hits);
87@@ -147,18 +153,36 @@ index 0000000..bbd0d82
88 + }
89 +
90 + g_list_free_full (search_hits->hits, g_object_unref);
91-+ g_object_unref (self->query);
92 + g_clear_object (&self->cancellable);
93-+ g_object_unref (self);
94 + g_free (search_hits);
95 +
96 + nautilus_search_provider_finished (provider,
97 + NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL);
98 + g_object_notify (G_OBJECT (provider), "running");
99 +
100++ g_object_unref (self);
101++
102 + return FALSE;
103 +}
104 +
105++static void
106++search_add_hits_idle (NautilusSearchEngineRecent *self,
107++ GList *hits)
108++{
109++ SearchHitsData *search_hits;
110++
111++ if (self->add_hits_idle_id != 0)
112++ {
113++ return;
114++ }
115++
116++ search_hits = g_new0 (SearchHitsData, 1);
117++ search_hits->recent = self;
118++ search_hits->hits = hits;
119++
120++ self->add_hits_idle_id = g_idle_add (search_thread_add_hits_idle, search_hits);
121++}
122++
123 +static gboolean
124 +is_file_valid_recursive (NautilusSearchEngineRecent *self,
125 + GFile *file,
126@@ -272,8 +296,8 @@ index 0000000..bbd0d82
127 +
128 + if (rank <= 0)
129 + {
130-+ name = gtk_recent_info_get_short_name (info);
131-+ rank = nautilus_query_matches_string (self->query, name);
132++ g_autofree char *short_name = gtk_recent_info_get_short_name (info);
133++ rank = nautilus_query_matches_string (self->query, short_name);
134 + }
135 +
136 + if (rank > 0)
137@@ -340,11 +364,7 @@ index 0000000..bbd0d82
138 + }
139 + }
140 +
141-+ search_hits = g_new0 (SearchHitsData, 1);
142-+ search_hits->recent = self;
143-+ search_hits->hits = hits;
144-+
145-+ g_idle_add (search_thread_add_hits_idle, search_hits);
146++ search_add_hits_idle (self, hits);
147 +
148 + g_list_free_full (recent_items, (GDestroyNotify) gtk_recent_info_unref);
149 + g_list_free_full (mime_types, g_free);
150@@ -362,23 +382,17 @@ index 0000000..bbd0d82
151 + g_return_if_fail (self->query);
152 + g_return_if_fail (self->cancellable == NULL);
153 +
154-+ g_object_ref (self);
155-+ g_object_ref (self->query);
156-+
157 + location = nautilus_query_get_location (self->query);
158 +
159 + if (!is_recursive_search (NAUTILUS_SEARCH_ENGINE_TYPE_INDEXED,
160 + nautilus_query_get_recursive (self->query),
161 + location))
162 + {
163-+ SearchHitsData *search_hits;
164-+ search_hits = g_new0 (SearchHitsData, 1);
165-+ search_hits->recent = self;
166-+
167-+ g_idle_add (search_thread_add_hits_idle, search_hits);
168++ search_add_hits_idle (self, NULL);
169 + return;
170 + }
171 +
172++ g_object_ref (self);
173 + self->cancellable = g_cancellable_new ();
174 +
175 + thread = g_thread_new ("nautilus-search-recent", recent_thread_func, self);

Subscribers

People subscribed via source and target branches