[gnome-shell] messageTray: Always remove destroyed banners



commit 1f4eea12a53e2ee126e1eca58dfb6e875ae3b72e
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 8 19:10:05 2021 +0200

    messageTray: Always remove destroyed banners
    
    Currently we only mark the banner as removed if it is destroyed
    while in SHOWN or SHOWING state, but not if we're already HIDING
    (for example in response to `NotificationBanner::done-displaying`).
    
    If this happens, we'll try to destroy the notification again at
    the end of the transition, which leads to (harmless but annoying)
    log spam since Notifications were turned into GObjects (that are
    disposed when destroyed).
    
    Address this by always marking destroyed banners as removed, while
    still only triggering a state update while shown (or in the process
    of being shown).
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4457
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1908>

 js/ui/messageTray.js | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index b793f8a167..654bada6b2 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1022,17 +1022,20 @@ var MessageTray = GObject.registerClass({
     }
 
     _onNotificationDestroy(notification) {
-        if (this._notification == notification && (this._notificationState == State.SHOWN || 
this._notificationState == State.SHOWING)) {
-            this._updateNotificationTimeout(0);
-            this._notificationRemoved = true;
-            this._updateState();
-            return;
-        }
+        this._notificationRemoved = this._notification === notification;
 
-        let index = this._notificationQueue.indexOf(notification);
-        if (index != -1) {
-            this._notificationQueue.splice(index, 1);
-            this.emit('queue-changed');
+        if (this._notificationRemoved) {
+            if (this._notificationState === State.SHOWN ||
+                this._notificationState === State.SHOWING) {
+                this._updateNotificationTimeout(0);
+                this._updateState();
+            }
+        } else {
+            const index = this._notificationQueue.indexOf(notification);
+            if (index !== -1) {
+                this._notificationQueue.splice(index, 1);
+                this.emit('queue-changed');
+            }
         }
     }
 


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