diff --git a/src/calibre/gui2/linux_file_dialogs.py b/src/calibre/gui2/linux_file_dialogs.py index be048b2862..de9420d55f 100644 --- a/src/calibre/gui2/linux_file_dialogs.py +++ b/src/calibre/gui2/linux_file_dialogs.py @@ -289,13 +289,13 @@ def linux_native_dialog(name): loop = QEventLoop(window) def r(): - while not loop.isRunning(): - time.sleep(0.001) # yield so that loop starts try: ret[0] = func(window, *args, **kwargs) except: ret[1] = sys.exc_info() sys.exc_clear() + while not loop.isRunning(): + time.sleep(0.001) # yield so that loop starts loop.quit() t = Thread(name='FileDialogHelper', target=r) t.daemon = True