[gnome-shell] search: Remove updateSearch later on destruction
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] search: Remove updateSearch later on destruction
- Date: Mon, 9 Sep 2019 19:37:55 +0000 (UTC)
commit c69e195441a691429d7b0e16f81e80ff062f1590
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Sat Aug 31 23:40:52 2019 +0200
search: Remove updateSearch later on destruction
When the GridSearchBase actor is destroyed we should remove the
ongoing later that might try to access to invalid resources.
To do this, add an _onDestroy() callback function to SearchResultsBase
and override it in GridSearchBase.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
js/ui/search.js | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index d55021ac91..d4de5ece25 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -158,10 +158,15 @@ var SearchResultsBase = class {
this._clipboard = St.Clipboard.get_default();
this._cancellable = new Gio.Cancellable();
+
+ this.actor.connect('destroy', this._onDestroy.bind(this));
}
destroy() {
this.actor.destroy();
+ }
+
+ _onDestroy() {
this._terms = [];
}
@@ -341,14 +346,30 @@ var GridSearchResults = class extends SearchResultsBase {
this._resultDisplayBin.set_child(this._bin);
}
+ _onDestroy() {
+ if (this._updateSearchLater) {
+ Meta.later_remove(this._updateSearchLater);
+ delete this._updateSearchLater;
+ }
+
+ super._onDestroy();
+ }
+
updateSearch(...args) {
if (this._notifyAllocationId)
this.actor.disconnect(this._notifyAllocationId);
+ if (this._updateSearchLater) {
+ Meta.later_remove(this._updateSearchLater);
+ delete this._updateSearchLater;
+ }
// Make sure the maximum number of results calculated by
// _getMaxDisplayedResults() is updated after width changes.
this._notifyAllocationId = this.actor.connect('notify::allocation', () => {
- Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ if (this._updateSearchLater)
+ return;
+ this._updateSearchLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ delete this._updateSearchLater;
super.updateSearch(...args);
return GLib.SOURCE_REMOVE;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]