diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-12-20 16:12:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-05 12:08:33 +0100 |
commit | 66d70f50621806fbc39e512e09e2187f8709cd2c (patch) | |
tree | 66f858aa1252ef6fc87b72c25fa9fde849be2609 /xmloff | |
parent | 21abead6dbb143c291db0a49270e658a3e279d27 (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.
(cherry picked from commit ee7ca8e4ea8ed93655f99e77a9e77032ac830c46)
Conflicts:
sfx2/source/view/lokhelper.cxx
Change-Id: I765e618f55caad791aa1fe7569a32bcc31622525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161541
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'xmloff')
0 files changed, 0 insertions, 0 deletions