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

Subscribers

People subscribed via source and target branches