From c9010e984e2bad1b121aeefb3a161e67752eee9a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 21 Jul 2010 18:53:43 +0900 Subject: [PATCH] fix race condition in deck browser signal handlers --- ankiqt/ui/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index dcaa38552..621224e6f 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -1341,7 +1341,7 @@ later by using File>Close. help="DeckBrowser"): self.config['recentDeckPaths'].remove(self.browserDecks[c]['path']) del self.browserDecks[c] - self.showDeckBrowser() + self.doLater(100, self.showDeckBrowser) def onDeckBrowserDelete(self, c): deck = self.browserDecks[c]['path'] @@ -1353,11 +1353,17 @@ later by using File>Close. except OSError: pass self.config['recentDeckPaths'].remove(deck) - self.showDeckBrowser() + self.doLater(100, self.showDeckBrowser) def onDeckBrowserForgetInaccessible(self): self.refreshBrowserDecks(forget=True) + def doLater(self, msecs, func): + timer = QTimer(self) + timer.setSingleShot(True) + timer.start(msecs) + self.connect(timer, SIGNAL("timeout()"), func) + # Opening and closing the app ##########################################################################