From 2391497f6009ebb1cdc79732e755130a0257cada Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 9 Feb 2024 13:14:39 -0500 Subject: [PATCH] misc: Don't call disconnectAll on token proxy objects The disconnectAll method is a method available to javascript] objects that want gobject-ish signal handling features. It is not a method available to GObjects come from introspection. "token" objects in the smartcard manager code are just plain old GDBusProxy objects and so don't have disconnectAll methods. This commit changes the code to use a direct disconnect call for the one pertinent signal connection instead. --- js/misc/smartcardManager.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/misc/smartcardManager.js b/js/misc/smartcardManager.js index a46a817c5..daba703be 100644 --- a/js/misc/smartcardManager.js +++ b/js/misc/smartcardManager.js @@ -78,7 +78,7 @@ class SmartcardManager extends Signals.EventEmitter { _addToken(token) { this._updateToken(token); - token.connect('g-properties-changed', (proxy, properties) => { + token._smartcardSignalId = token.connect('g-properties-changed', (proxy, properties) => { const isInsertedChanged = !!properties.lookup_value('IsInserted', null); if (isInsertedChanged) { this._updateToken(token); @@ -103,10 +103,13 @@ class SmartcardManager extends Signals.EventEmitter { this.emit('smartcard-removed', token); } + if (token._smartcardSignalId) { + token.disconnect(token._smartcardSignalId); + delete token._smartcardSignalId; + } + if (this._loginToken === token) this._loginToken = null; - - token.disconnectAll(); } hasInsertedTokens() {