electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit caadc5a5bbf3a4cba8020609f3944c5ae5f23f48
parent aaa67adb5ab421c75ebe8cae6a4989ab88d62008
Author: Janus <ysangkok@gmail.com>
Date:   Fri, 13 Apr 2018 19:22:01 +0200

lightning_channels_list: use signals to avoid segfault

Diffstat:
Mgui/qt/lightning_channels_list.py | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/gui/qt/lightning_channels_list.py b/gui/qt/lightning_channels_list.py @@ -4,6 +4,7 @@ from PyQt5 import QtCore, QtWidgets from collections import OrderedDict import logging from electrum.lightning import lightningCall +import traceback mapping = {0: "channel_point"} revMapp = {"channel_point": 0} @@ -39,6 +40,8 @@ def clickHandler(nodeIdInput, local_amt_inp, push_amt_inp, lightningRpc): lightningCall(lightningRpc, "openchannel")(str(nodeId), local_amt_inp.text(), push_amt_inp.text()) class LightningChannelsList(QtWidgets.QWidget): + update_rows = QtCore.pyqtSignal(str, dict) + def create_menu(self, position): menu = QtWidgets.QMenu() cur = self._tv.currentItem() @@ -67,6 +70,15 @@ class LightningChannelsList(QtWidgets.QWidget): except KeyError: obj[k] = v def lightningRpcHandler(self, methodName, obj): + if isinstance(obj, Exception): + try: + raise obj + except: + traceback.print_exc() + else: + self.update_rows.emit(methodName, obj) + + def do_update_rows(self, methodName, obj): if methodName != "listchannels": print("channel list ignoring reply {} to {}".format(obj, methodName)) return @@ -78,6 +90,8 @@ class LightningChannelsList(QtWidgets.QWidget): def __init__(self, parent, lightningWorker, lightningRpc): QtWidgets.QWidget.__init__(self, parent) + self.update_rows.connect(self.do_update_rows) + def tick(): lightningCall(lightningRpc, "listchannels")()