[gnome-shell] shellInfo: Don't destroy source on undo



commit 6995c2fa9f1a0b6cf673d233a0bd9f615c3093ef
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 8 19:23:38 2021 +0200

    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>

 js/ui/overview.js | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 529779ea8b..c71b113898 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -25,16 +25,6 @@ var OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
 var ShellInfo = class {
     constructor() {
         this._source = null;
-        this._undoCallback = null;
-    }
-
-    _onUndoClicked() {
-        if (this._undoCallback)
-            this._undoCallback();
-        this._undoCallback = null;
-
-        if (this._source)
-            this._source.destroy();
     }
 
     setMessage(text, options) {
@@ -64,9 +54,8 @@ var ShellInfo = class {
             notification.update(text, null, { clear: true });
         }
 
-        this._undoCallback = undoCallback;
         if (undoCallback)
-            notification.addAction(_("Undo"), this._onUndoClicked.bind(this));
+            notification.addAction(_('Undo'), () => undoCallback());
 
         this._source.showNotification(notification);
     }


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