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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user