diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-12-20 16:12:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-12-20 22:37:32 +0100 |
commit | ee7ca8e4ea8ed93655f99e77a9e77032ac830c46 (patch) | |
tree | 56f80447a3892eff8195e5741b9a8e0f3a644d2d /sc | |
parent | 1a81fd69e10ad1ce7193fe7231ff29b2b94f67c7 (diff) |
cool#7865 sfx2 lok: fix bad view id on async command dispatch
If you try hard enough, it's possible to request an "add conditional
format" dialog in one view and have the dialog pop up in an other view.
This is related to cool#7853 but it focuses on the wider problem.
What happens is that sometimes we do want to execute an uno command in
an async way, e.g. one dialog opening an other dialog in its response
handler: making sure the dialog is not manually / synchronously spinning
the main loop while it's running is wanted. Also fixing each & every
async command dispatch manually would be a lot of work.
Fix the problem by remembering the current view in SfxHintPoster::Post()
as it posts events to the main loop and restoring that view if necessary
in SfxHintPoster::DoEvent_Impl().
Other comments:
- An alternative would be to just dispatch all these UNO commands
synchronously, but see above, there are cases where we want to stay
async, a nested main loop would be worse.
- An even more general fix would be to handle all calls to
Application::PostUserEvent(), but vcl doesn't know what is the
current view and would have trouble switching to that view (only sfx2
and higher up knows that), so do this only at a SfxHintPoster::Post()
level, this is already meant to fix all async uno commands.
- There was a single case in sd/ where we tried to dispatch an async
event while switching views, so switch to a sync command dispatch
there to avoid the problem. CppunitTest_sd_tiledrendering would hang
without this and would emit a warning in SfxHintPoster::Post().
- Restore the sc/ code to do its async dispatch as it used to, so now
CppunitTest_sc_tiledrendering's testOpenURL is a test case that covers
this change.
Change-Id: I765e618f55caad791aa1fe7569a32bcc31622525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161071
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/global.cxx | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 15fdc7dfb39d..29a616c6b6e8 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -879,17 +879,8 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, bool bIgno SfxBoolItem aBrowsing( SID_BROWSE, true ); // No SID_SILENT anymore - SfxCallMode nCall = SfxCallMode::RECORD; - if (comphelper::LibreOfficeKit::isActive()) - { - nCall |= SfxCallMode::SYNCHRON; - } - else - { - nCall |= SfxCallMode::ASYNCHRON; - } pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, - nCall, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing }); } |