mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
fix race condition in webview load on Windows
- don't require collection for initial blank content - defer profile load until initial blank content loaded - use plain text for blank content to prevent initial flash of white
This commit is contained in:
parent
d24d485f06
commit
015bb71cca
1 changed files with 18 additions and 2 deletions
20
aqt/main.py
20
aqt/main.py
|
@ -56,7 +56,11 @@ class AnkiQt(QMainWindow):
|
|||
self.onAppMsg(args[0])
|
||||
# Load profile in a timer so we can let the window finish init and not
|
||||
# close on profile load error.
|
||||
self.progress.timer(10, self.setupProfile, False, requiresCollection=False)
|
||||
if isWin:
|
||||
fn = self.setupProfileAfterWebviewsLoaded
|
||||
else:
|
||||
fn = self.setupProfile
|
||||
self.progress.timer(10, fn, False, requiresCollection=False)
|
||||
|
||||
def setupUI(self):
|
||||
self.col = None
|
||||
|
@ -84,6 +88,16 @@ class AnkiQt(QMainWindow):
|
|||
self.setupOverview()
|
||||
self.setupReviewer()
|
||||
|
||||
def setupProfileAfterWebviewsLoaded(self):
|
||||
for w in (self.web, self.bottomWeb):
|
||||
if not w._domDone:
|
||||
self.progress.timer(10, self.setupProfileAfterWebviewsLoaded, False, requiresCollection=False)
|
||||
return
|
||||
else:
|
||||
w.requiresCol = True
|
||||
|
||||
self.setupProfile()
|
||||
|
||||
# Profiles
|
||||
##########################################################################
|
||||
|
||||
|
@ -610,7 +624,9 @@ title="%s" %s>%s</button>''' % (
|
|||
# force webengine processes to load before cwd is changed
|
||||
if isWin:
|
||||
for o in self.web, self.bottomWeb:
|
||||
o._setHtml("")
|
||||
o.requiresCol = False
|
||||
o._domReady = False
|
||||
o._page.setContent(bytes("", "ascii"))
|
||||
|
||||
def closeAllWindows(self, onsuccess):
|
||||
aqt.dialogs.closeAll(onsuccess)
|
||||
|
|
Loading…
Reference in a new issue