Emscripten: Pre-cancel synchronous execution of modal dialogs

...which would run into Application::Yield -> std::abort, so better live with
this hack for now.  (The way forward would be to either asyncify relevant
dialogs, or move to Qt6 and --enable-emscripten-jspi.)

Change-Id: I143747cc32fb163e4908fa42b031e4eaea697d29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182731
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Stephan Bergmann
2025-03-10 13:55:42 +01:00
parent 8888e6f42d
commit 376466a745
2 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ public:
virtual FactoryFunction GetUITestFactory() const override;
private:
bool ImplStartExecute();
bool ImplStartExecute(bool async);
static void ImplEndExecuteModal();
void ImplSetModalInputMode(bool bModal);
+11 -3
View File
@@ -907,7 +907,7 @@ bool Dialog::Close()
}
}
bool Dialog::ImplStartExecute()
bool Dialog::ImplStartExecute(bool async)
{
setDeferredProperties();
@@ -951,6 +951,14 @@ bool Dialog::ImplStartExecute()
return false;
}
}
if (!async && Application::IsUseSystemEventLoop())
{
// As long as Application::Yield deliberately calls std::abort when trying to
// synchronously execute modal dialogs, better cancel them here for now as a hack:
SAL_WARN(
"vcl", "cancel synchronous execution of modal dialog " << ImplGetDialogText(this));
return false;
}
switch ( Application::GetDialogCancelMode() )
{
@@ -1081,7 +1089,7 @@ short Dialog::Execute()
mbInSyncExecute = false;
});
if ( !ImplStartExecute() )
if ( !ImplStartExecute(false) )
return 0;
// Yield util EndDialog is called or dialog gets destroyed
@@ -1111,7 +1119,7 @@ short Dialog::Execute()
bool Dialog::StartExecuteAsync( VclAbstractDialog::AsyncContext &rCtx )
{
const bool bModal = GetType() != WindowType::MODELESSDIALOG;
if (!ImplStartExecute())
if (!ImplStartExecute(true))
{
rCtx.mxOwner.disposeAndClear();
rCtx.mxOwnerDialogController.reset();