shellInfo: Don't destroy source on undo
Destroying the source from an action callback will result in the notification being destroyed twice: - source.destroy() destroys all its notifications - a notification destroys itself after an action was activated This results in unwanted log spam when attempting to dispose the notification for a second time. There is actually no good reason for destroying the source explicitly, as sources already self-destruct with their last notification. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4457 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1908>
This commit is contained in:
parent
1f4eea12a5
commit
6995c2fa9f
@ -25,16 +25,6 @@ var OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
|
|||||||
var ShellInfo = class {
|
var ShellInfo = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._source = null;
|
this._source = null;
|
||||||
this._undoCallback = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
_onUndoClicked() {
|
|
||||||
if (this._undoCallback)
|
|
||||||
this._undoCallback();
|
|
||||||
this._undoCallback = null;
|
|
||||||
|
|
||||||
if (this._source)
|
|
||||||
this._source.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setMessage(text, options) {
|
setMessage(text, options) {
|
||||||
@ -64,9 +54,8 @@ var ShellInfo = class {
|
|||||||
notification.update(text, null, { clear: true });
|
notification.update(text, null, { clear: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
this._undoCallback = undoCallback;
|
|
||||||
if (undoCallback)
|
if (undoCallback)
|
||||||
notification.addAction(_("Undo"), this._onUndoClicked.bind(this));
|
notification.addAction(_('Undo'), () => undoCallback());
|
||||||
|
|
||||||
this._source.showNotification(notification);
|
this._source.showNotification(notification);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user