[gnome-shell/wip/fmuellner/calendar-warnings] calendar: Disconnect signals when resetting notification



commit 70e4bed13481f89799f660bc290192a22713e05b
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Nov 23 16:22:45 2018 +0100

    calendar: Disconnect signals when resetting notification
    
    Since commit 5fb8d4f730, a NotificationMessage's notification property
    is reset to null when the notification is destroyed. However at that
    point we still have connected signal handlers around that we'll try
    to disconnect later.
    
    Avoid the warnings by disconnecting and resetting the handler IDs at
    the same time as the notification.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/308

 js/ui/calendar.js | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 432986391..6f31f2731 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -777,6 +777,7 @@ var NotificationMessage = new Lang.Class({
                 this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
         });
         this._destroyId = notification.connect('destroy', () => {
+            this._disconnectNotificationSignals();
             this.notification = null;
             if (!this._closed)
                 this.close();
@@ -806,7 +807,10 @@ var NotificationMessage = new Lang.Class({
 
     _onDestroy() {
         this.parent();
+        this._disconnectNotificationSignals();
+    },
 
+    _disconnectNotificationSignals() {
         if (this._updatedId)
             this.notification.disconnect(this._updatedId);
         this._updatedId = 0;


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