From 6be44425953254ea8b5aa6a4e573eec98d4514f7 Mon Sep 17 00:00:00 2001 From: Benjamin Hennion <17818041+bhennion@users.noreply.github.com> Date: Sun, 5 May 2024 19:09:47 +0200 Subject: [PATCH] Fix missing pdf dialog not disappearing --- src/core/control/Control.cpp | 12 +++++++----- src/core/control/Control.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/control/Control.cpp b/src/core/control/Control.cpp index 473d22031c26..3ae819252aab 100644 --- a/src/core/control/Control.cpp +++ b/src/core/control/Control.cpp @@ -1623,7 +1623,7 @@ void Control::promptMissingPdf(LoadHandler& loadHandler, const fs::path& filepat std::bind(&Control::missingPdfDialogResponseHandler, this, proposedPdfFilepath, std::placeholders::_1)); } -void Control::missingPdfDialogResponseHandler(const fs::path& proposedPdfFilepath, int responseId) { +void Control::missingPdfDialogResponseHandler(fs::path proposedPdfFilepath, int responseId) { switch (static_cast(responseId)) { case MissingPdfDialogOptions::USE_PROPOSED: if (!proposedPdfFilepath.empty()) { @@ -1631,10 +1631,12 @@ void Control::missingPdfDialogResponseHandler(const fs::path& proposedPdfFilepat } break; case MissingPdfDialogOptions::SELECT_OTHER: - XojOpenDlg::showAnnotatePdfDialog(getGtkWindow(), settings, [this](fs::path path, bool attachPdf) { - if (!path.empty()) { - this->pageBackgroundChangeController->changePdfPagesBackground(path, attachPdf); - } + Util::execInUiThread([this]() { + XojOpenDlg::showAnnotatePdfDialog(getGtkWindow(), settings, [this](fs::path path, bool attachPdf) { + if (!path.empty()) { + this->pageBackgroundChangeController->changePdfPagesBackground(path, attachPdf); + } + }); }); break; case MissingPdfDialogOptions::REMOVE: diff --git a/src/core/control/Control.h b/src/core/control/Control.h index 9ee52fb5a9c1..76f2113e4b1d 100644 --- a/src/core/control/Control.h +++ b/src/core/control/Control.h @@ -408,7 +408,7 @@ class Control: /** * Handle the response from the missing PDF dialog */ - void missingPdfDialogResponseHandler(const fs::path& proposedPdfFilepath, int responseId); + void missingPdfDialogResponseHandler(fs::path proposedPdfFilepath, int responseId); /** * "Closes" the document, preparing the editor for a new document.