From 21966afbc6992fa825217666c2f7de55e1d61be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Wed, 7 Aug 2019 17:39:25 +0200 Subject: [PATCH] search: Defer updating results on allocation changes until redraw Since the `notify::allocation` signal will obviously get emitted while the actor is inside an allocation cycle and we might end up doing changes to its allocation inside `updateSearch` by hiding or showing the actor (which queues a relayout), we get a warning from Clutter. Fix this by delaying the call to the parent method until the next redraw, which should happen a few moments after the current relayout. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/672 --- js/ui/search.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/ui/search.js b/js/ui/search.js index 7a7a5071f..d55021ac9 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi; +const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; const Signals = imports.signals; const AppDisplay = imports.ui.appDisplay; @@ -348,7 +348,10 @@ var GridSearchResults = class extends SearchResultsBase { // Make sure the maximum number of results calculated by // _getMaxDisplayedResults() is updated after width changes. this._notifyAllocationId = this.actor.connect('notify::allocation', () => { - super.updateSearch(...args); + Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { + super.updateSearch(...args); + return GLib.SOURCE_REMOVE; + }); }); super.updateSearch(...args);