From 7b0a94b246a241d17891ab4f8a49df2072fbfc98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 4 Mar 2022 23:34:59 +0100 Subject: [PATCH] signalTracker: Use connect_after to track 'destroy' The 'destroy' signal currently doesn't work with connectObject(), because the handler is only connected after the signal tracker's own destroy handler, which disconnects all handlers. Address this by using connect_after for the cleanup handler, so that other destroy handlers run before it (unless they also use ConnectFlags.AFTER, but well *shrug*). Part-of: --- js/misc/signalTracker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/misc/signalTracker.js b/js/misc/signalTracker.js index 936681475..b7aff10dc 100644 --- a/js/misc/signalTracker.js +++ b/js/misc/signalTracker.js @@ -32,7 +32,7 @@ class SignalTracker { */ constructor(owner) { if (this._hasDestroySignal(owner)) - this._ownerDestroyId = owner.connect('destroy', () => this.clear()); + this._ownerDestroyId = owner.connect_after('destroy', () => this.clear()); this._owner = owner; this._map = new Map(); @@ -73,7 +73,7 @@ class SignalTracker { const signalData = this._getSignalData(obj); if (signalData.destroyId) return; - signalData.destroyId = obj.connect('destroy', () => this.untrack(obj)); + signalData.destroyId = obj.connect_after('destroy', () => this.untrack(obj)); } _disconnectSignal(obj, id) {