[gnome-shell] search: Ignore search provider results metas if search is cancelled



commit 760406002f6e8cfcaf69337aa8d8b0bb8194194e
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Thu Aug 30 07:11:24 2018 +0200

    search: Ignore search provider results metas if search is cancelled
    
    When a search has been cancelled, it is expected that providers don't
    return the requested number of results, so don't log a warning in that
    case.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/205

 js/ui/search.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 804be9593..396674107 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -226,6 +226,12 @@ var SearchResultsBase = new Lang.Class({
             this._cancellable.reset();
 
             this.provider.getResultMetas(metasNeeded, metas => {
+                if (this._cancellable.is_cancelled()) {
+                    if (metas.length > 0)
+                        log(`Search provider ${this.provider.id} returned results after the request was 
canceled`);
+                    callback(false);
+                    return;
+                }
                 if (metas.length != metasNeeded.length) {
                     log('Wrong number of result metas returned by search provider ' + this.provider.id +
                         ': expected ' + metasNeeded.length + ' but got ' + metas.length);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]