Merge ~3v1n0/ubuntu/+source/gnome-shell:ubuntu/bionic-xubuntu-cancel-search into ~ubuntu-desktop/ubuntu/+source/gnome-shell:ubuntu/bionic

Proposed by Marco Trevisan (Treviño)
Status: Needs review
Proposed branch: ~3v1n0/ubuntu/+source/gnome-shell:ubuntu/bionic-xubuntu-cancel-search
Merge into: ~ubuntu-desktop/ubuntu/+source/gnome-shell:ubuntu/bionic
Diff against target: 210 lines (+179/-0)
4 files modified
debian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch (+167/-0)
debian/rules (+2/-0)
Reviewer Review Type Date Requested Status
Iain Lane Pending
Review via email: mp+358477@code.launchpad.net

Description of the change

Reproposing after the revert...

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

I'm currently dealing with some horrible rebases due to Ubuntu patches in nautilus, e.g. <https://bugzilla.gnome.org/show_bug.cgi?id=758833>.

How can we be sure that this XUbuntuCancel stuff isn't going to end up in the same state?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I totally hope the same.

I just wish the upstream issue I opened to move with a proper fix will move, because I can't do much other than propose stuff, and ask for some discussion.

7744a4c... by Marco Trevisan (Treviño)

debian/rules: Honour nocheck parameter

381a8a6... by Marco Trevisan (Treviño)

Update changelog

c689ab3... by Marco Trevisan (Treviño)

Finalise changelog

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ok, I've finally rebased this.

Unmerged commits

c689ab3... by Marco Trevisan (Treviño)

Finalise changelog

381a8a6... by Marco Trevisan (Treviño)

Update changelog

7744a4c... by Marco Trevisan (Treviño)

debian/rules: Honour nocheck parameter

87d3119... by Marco Trevisan (Treviño)

debian/patches: add support for XUbuntuCancel on remote search provider

Fixes LP: #1756826

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 6ef6396..9871aec 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,12 @@
6+gnome-shell (3.28.4-0ubuntu18.04.3) bionic; urgency=medium
7+
8+ * d/p/ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch:
9+ - Add support for cancelling remote search providers when the overlay
10+ is closed (and actually stop searches when requested from UI, LP: #1756826)
11+ * debian/rules: Honour nocheck parameter
12+
13+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Fri, 25 Oct 2019 05:23:08 +0200
14+
15 gnome-shell (3.28.4-0ubuntu18.04.2) bionic; urgency=medium
16
17 * d/p/osk-layouts-Fix-French-layout.patch:
18diff --git a/debian/patches/series b/debian/patches/series
19index da5bfc2..5e82144 100644
20--- a/debian/patches/series
21+++ b/debian/patches/series
22@@ -26,3 +26,4 @@ CVE-2019-3820-2.patch
23 switchMonitor-switch-to-next-config-upon-initial-keypress.patch
24 st-widget-Add-missing-g_return_val_if_fail.patch
25 osk-layouts-Fix-French-layout.patch
26+ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch
27diff --git a/debian/patches/ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch b/debian/patches/ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch
28new file mode 100644
29index 0000000..601a8ec
30--- /dev/null
31+++ b/debian/patches/ubuntu/search-call-XUbuntuCancel-method-on-providers-when-no-dat.patch
32@@ -0,0 +1,167 @@
33+From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
34+Date: Thu, 23 Aug 2018 20:00:57 +0200
35+Subject: search: call XUbuntuCancel method on providers when no data is
36+ needed
37+
38+Add XUbuntuCancel method to search providers and call it when a search provider
39+is still doing operations.
40+Ignore the result when the method does not exist or is cancelled.
41+
42+This will allow to stop operations on providers.
43+
44+Fixes LP: #1756826
45+
46+Bug-GNOME: https://gitlab.gnome.org/GNOME/gnome-shell/issues/183
47+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/bionic/+source/gnome-shell/+bug/1756826
48+Forwarded: not-needed
49+---
50+ data/org.gnome.ShellSearchProvider.xml | 6 ++++++
51+ data/org.gnome.ShellSearchProvider2.xml | 6 ++++++
52+ js/ui/remoteSearch.js | 15 +++++++++++++++
53+ js/ui/search.js | 34 +++++++++++++++++++++++++++++++++
54+ 4 files changed, 61 insertions(+)
55+
56+diff --git a/data/org.gnome.ShellSearchProvider.xml b/data/org.gnome.ShellSearchProvider.xml
57+index 78ad305..393cb01 100644
58+--- a/data/org.gnome.ShellSearchProvider.xml
59++++ b/data/org.gnome.ShellSearchProvider.xml
60+@@ -69,5 +69,11 @@
61+ <method name="ActivateResult">
62+ <arg type="s" name="identifier" direction="in" />
63+ </method>
64++
65++ <!--
66++ XUbuntuCancel:
67++ Cancel the current search operation
68++ -->
69++ <method name="XUbuntuCancel" />
70+ </interface>
71+ </node>
72+diff --git a/data/org.gnome.ShellSearchProvider2.xml b/data/org.gnome.ShellSearchProvider2.xml
73+index 9502340..8141bc0 100644
74+--- a/data/org.gnome.ShellSearchProvider2.xml
75++++ b/data/org.gnome.ShellSearchProvider2.xml
76+@@ -83,5 +83,11 @@
77+ <arg type="as" name="terms" direction="in" />
78+ <arg type="u" name="timestamp" direction="in" />
79+ </method>
80++
81++ <!--
82++ XUbuntuCancel:
83++ Cancel the current search operation
84++ -->
85++ <method name="XUbuntuCancel" />
86+ </interface>
87+ </node>
88+diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js
89+index c6c5a29..8de6148 100644
90+--- a/js/ui/remoteSearch.js
91++++ b/js/ui/remoteSearch.js
92+@@ -30,6 +30,7 @@ const SearchProviderIface = '<node> \
93+ <method name="ActivateResult"> \
94+ <arg type="s" direction="in" /> \
95+ </method> \
96++<method name="XUbuntuCancel" /> \
97+ </interface> \
98+ </node>';
99+
100+@@ -57,6 +58,7 @@ const SearchProvider2Iface = '<node> \
101+ <arg type="as" direction="in" /> \
102+ <arg type="u" direction="in" /> \
103+ </method> \
104++<method name="XUbuntuCancel" /> \
105+ </interface> \
106+ </node>';
107+
108+@@ -310,6 +312,19 @@ var RemoteSearchProvider = new Lang.Class({
109+ cancellable);
110+ },
111+
112++ XUbuntuCancel(cancellable, callback) {
113++ this.proxy.XUbuntuCancelRemote((results, error) => {
114++ if (error &&
115++ !error.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD) &&
116++ !error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
117++ log('Received error from DBus search provider %s during XUbuntuCancel: %s'.format(this.id, String(error)));
118++ } else if (callback && !error) {
119++ callback();
120++ }
121++ },
122++ cancellable);
123++ },
124++
125+ activateResult(id) {
126+ this.proxy.ActivateResultRemote(id);
127+ },
128+diff --git a/js/ui/search.js b/js/ui/search.js
129+index 3966741..c67feea 100644
130+--- a/js/ui/search.js
131++++ b/js/ui/search.js
132+@@ -225,7 +225,9 @@ var SearchResultsBase = new Lang.Class({
133+ this._cancellable.cancel();
134+ this._cancellable.reset();
135+
136++ this.provider.resultsMetasInProgress = true;
137+ this.provider.getResultMetas(metasNeeded, metas => {
138++ this.provider.resultsMetasInProgress = this._cancellable.is_cancelled();
139+ if (this._cancellable.is_cancelled()) {
140+ if (metas.length > 0)
141+ log(`Search provider ${this.provider.id} returned results after the request was canceled`);
142+@@ -455,6 +457,10 @@ var SearchResults = new Lang.Class({
143+
144+ this._searchTimeoutId = 0;
145+ this._cancellable = new Gio.Cancellable();
146++ this._searchCancelCancellable = new Gio.Cancellable();
147++ this._cancellable.connect(() => {
148++ this._cancelSearchProviderRequest();
149++ });
150+
151+ this._registerProvider(new AppDisplay.AppSearchProvider());
152+ this._reloadRemoteProviders();
153+@@ -496,11 +502,32 @@ var SearchResults = new Lang.Class({
154+ }
155+ },
156+
157++ _cancelSearchProviderRequest() {
158++ if (this._terms.length != 0 || this._searchCancelTimeoutId > 0)
159++ return;
160++
161++ this._searchCancelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, () => {
162++ this._providers.forEach(provider => {
163++ if (provider.isRemoteProvider &&
164++ (provider.searchInProgress || provider.resultsMetasInProgress)) {
165++ provider.XUbuntuCancel(this._searchCancelCancellable, () => {
166++ provider.searchInProgress = false;
167++ provider.resultsMetasInProgress = false;
168++ });
169++ }
170++ });
171++
172++ delete this._searchCancelTimeoutId;
173++ return GLib.SOURCE_REMOVE;
174++ });
175++ },
176++
177+ _reset() {
178+ this._terms = [];
179+ this._results = {};
180+ this._clearDisplay();
181+ this._clearSearchTimeout();
182++ this._cancelSearchProviderRequest();
183+ this._defaultResult = null;
184+ this._startingSearch = false;
185+
186+@@ -567,6 +594,13 @@ var SearchResults = new Lang.Class({
187+ if (this._terms.length > 0)
188+ isSubSearch = searchString.indexOf(previousSearchString) == 0;
189+
190++ this._searchCancelCancellable.cancel();
191++ this._searchCancelCancellable.reset();
192++ if (this._searchCancelTimeoutId > 0) {
193++ GLib.source_remove(this._searchCancelTimeoutId);
194++ delete this._searchCancelTimeoutId;
195++ }
196++
197+ this._terms = terms;
198+ this._isSubSearch = isSubSearch;
199+ this._updateSearchProgress();
200diff --git a/debian/rules b/debian/rules
201index 00fe711..4f2b3fb 100755
202--- a/debian/rules
203+++ b/debian/rules
204@@ -52,4 +52,6 @@ override_dh_strip:
205 dh_strip --dbgsym-migration='gnome-shell-dbg (<< 3.20.2-2~)'
206
207 override_dh_auto_test:
208+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
209 xvfb-run dh_auto_test
210+endif

Subscribers

People subscribed via source and target branches