Merge ~3v1n0/ubuntu/+source/nautilus:ubuntu/master into ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master

Proposed by Marco Trevisan (Treviño) on 2018-10-04
Status: Merged
Merged at revision: f3dbfd5d54270e4c56048ee8cd9dfceab485c091
Proposed branch: ~3v1n0/ubuntu/+source/nautilus:ubuntu/master
Merge into: ~ubuntu-desktop/ubuntu/+source/nautilus:ubuntu/master
Diff against target: 172 lines (+45/-24)
2 files modified
debian/changelog (+7/-0)
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+356146@code.launchpad.net
To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

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

Subscribers

People subscribed via source and target branches