From 7102fcdf7c1447af0656232f0683e0b6ec80ce2e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Aug 2017 20:44:50 +0530 Subject: [PATCH] Dont sleep unnecessarily in the common case --- src/calibre/gui2/linux_file_dialogs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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