Fix discard changes randomly being a noop on certain linux systems (#3781)

* fix discard changes randomly being a noop on certain linux systems

* use QApplication.setActiveWindow instead

* revert current impl

* wait for the next event loop iter before calling activeWindow
This commit is contained in:
llama 2025-02-03 00:31:36 +08:00 committed by GitHub
parent fab939e0e1
commit 009a683e62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -581,7 +581,9 @@ def deck_options_require_close() -> bytes:
if isinstance(window, DeckOptionsDialog):
window.require_close()
aqt.mw.taskman.run_on_main(handle_on_main)
# on certain linux systems, askUser's QMessageBox.question unsets the active window
# so we wait for the next event loop before querying the next current active window
aqt.mw.taskman.run_on_main(lambda: QTimer.singleShot(0, handle_on_main))
return b""