aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-05-13 18:58:10 +0000
committerSaturneric <[email protected]>2022-05-13 18:58:10 +0000
commit9a4cee6ca12aab72ca6b921724950c04bdffccc0 (patch)
tree038086d7138e35dff8e8b5b124e55b2995e7d8db
parentfix: slove shared link problem (diff)
downloadGpgFrontend-9a4cee6ca12aab72ca6b921724950c04bdffccc0.tar.gz
GpgFrontend-9a4cee6ca12aab72ca6b921724950c04bdffccc0.zip
fix: slove loading issues at init
1. block the main thread until the gpg context is loaded.
-rw-r--r--src/ui/GpgFrontendUIInit.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp
index a5302c7b..e7751ee6 100644
--- a/src/ui/GpgFrontendUIInit.cpp
+++ b/src/ui/GpgFrontendUIInit.cpp
@@ -72,6 +72,7 @@ void InitGpgFrontendUI() {
waiting_dialog->finished(0);
waiting_dialog->deleteLater();
});
+
QApplication::connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
LOG(INFO) << "cancel clicked";
QCoreApplication::quit();
@@ -83,9 +84,18 @@ void InitGpgFrontendUI() {
waiting_dialog->show();
waiting_dialog->setFocus();
+ // new local event looper
+ QEventLoop looper;
+ QApplication::connect(init_ctx_task,
+ &Thread::CtxCheckTask::SignalTaskFinished, &looper,
+ &QEventLoop::quit);
+
// start the thread to load the gpg context
Thread::TaskRunnerGetter::GetInstance().GetTaskRunner()->PostTask(
init_ctx_task);
+
+ // block the main thread until the gpg context is loaded
+ looper.exec();
}
int RunGpgFrontendUI() {