From b8baceb6296bd3c960686ea53416de6a1b35d55e Mon Sep 17 00:00:00 2001 From: mailchuck Date: Sun, 4 Oct 2015 20:32:17 +0200 Subject: [PATCH] Fix: recurse prevention In case something screws up, prevent recursive changes through treeWidgetItemChagned --- src/bitmessageqt/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 3cd884c7..6feb12cb 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -587,6 +587,8 @@ class MyForm(QtGui.QMainWindow): self.timer.start(2000) # milliseconds QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds) + self.recurDepth = 0 + self.init_file_menu() self.init_inbox_popup_menu() self.init_identities_popup_menu() @@ -595,7 +597,7 @@ class MyForm(QtGui.QMainWindow): self.init_chan_popup_menu() self.init_sent_popup_menu() self.init_blacklist_popup_menu() - + # Initialize the user's list of addresses on the 'Chan' tab. self.rerenderTabTreeChans() @@ -3488,10 +3490,16 @@ more work your computer must do to send the message. A Time-To-Live of four or f # unchanged, do not do anything either if newLabel == oldLabel: return - + + # recursion prevention + if self.recurDepth > 0: + return + + self.recurDepth += 1 shared.config.set(str(item.address), 'label', newLabel) item.updateText() shared.writeKeysFile() + self.recurDepth -= 1 def tableWidgetInboxItemClicked(self): folder = self.getCurrentFolder()