Browse Source

unregister callback when object gets destroyed.

turns out we need to use a lambda to have the signal processed,
registering the member function somehow never triggers the
'destroyed' signal
patch-4
Sander van Grieken 3 years ago
parent
commit
f0d00dca37
  1. 6
      electrum/gui/qml/qechanneldetails.py

6
electrum/gui/qml/qechanneldetails.py

@ -18,7 +18,8 @@ class QEChannelDetails(QObject):
def __init__(self, parent=None):
super().__init__(parent)
register_callback(self.on_network, ['channel']) # TODO unregister too
register_callback(self.on_network, ['channel'])
self.destroyed.connect(lambda: self.on_destroy())
def on_network(self, event, *args):
if event == 'channel':
@ -26,6 +27,9 @@ class QEChannelDetails(QObject):
if wallet == self._wallet.wallet and self._channelid == channel.channel_id.hex():
self.channelChanged.emit()
def on_destroy(self):
unregister_callback(self.on_network)
walletChanged = pyqtSignal()
@pyqtProperty(QEWallet, notify=walletChanged)
def wallet(self):

Loading…
Cancel
Save