From adb4470564587543533f5ef7275b8efcab881e23 Mon Sep 17 00:00:00 2001 From: Lan Zagar Date: Tue, 3 Jan 2017 13:57:16 +0100 Subject: [PATCH] Merge pull request #1825 from janezd/fix-listview-unselect [FIX] Fix crash in listview if labels are changed before calling __setitem__ (cherry picked from commit 3ca970800e08169bc397bf02bce00d0b70a05730) --- Orange/widgets/gui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/gui.py b/Orange/widgets/gui.py index 0d2e36198f9..23e59e12aa2 100644 --- a/Orange/widgets/gui.py +++ b/Orange/widgets/gui.py @@ -2049,7 +2049,10 @@ def item2name(self, item): def __setitem__(self, index, item): def unselect(i): - item = self.listBox.item(i) + try: + item = self.listBox.item(i) + except RuntimeError: # Underlying C/C++ object has been deleted + item = None if item is None: # Labels changed before clearing the selection: clear everything self.listBox.selectionModel().clear()