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):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
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):
|
def on_network(self, event, *args):
|
||||||
if event == 'channel':
|
if event == 'channel':
|
||||||
@@ -26,6 +27,9 @@ class QEChannelDetails(QObject):
|
|||||||
if wallet == self._wallet.wallet and self._channelid == channel.channel_id.hex():
|
if wallet == self._wallet.wallet and self._channelid == channel.channel_id.hex():
|
||||||
self.channelChanged.emit()
|
self.channelChanged.emit()
|
||||||
|
|
||||||
|
def on_destroy(self):
|
||||||
|
unregister_callback(self.on_network)
|
||||||
|
|
||||||
walletChanged = pyqtSignal()
|
walletChanged = pyqtSignal()
|
||||||
@pyqtProperty(QEWallet, notify=walletChanged)
|
@pyqtProperty(QEWallet, notify=walletChanged)
|
||||||
def wallet(self):
|
def wallet(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user