summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-04-13 08:01:29 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2022-04-14 19:28:41 +0200
commite0a27e60ab8e37d89b350efc0c3c7abf65f483d0 (patch)
treef372e9d67b967901d2cdb45a0e8a5cbc09bde7de
parente54e77cb349ef9ad5ae1f38d217aec0be3ff0616 (diff)
Prevent save interception when sharing Calc doc
Using the dispatch mechanism means that this can be caught by the dispatch interceptor which we don't want in this place. Change-Id: Ie7e5f92e6043e2aff98d4887829a3573c12c6d08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132947 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--sfx2/source/doc/objmisc.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 91817a637620..5b078261910f 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -106,6 +106,7 @@
#include <sfx2/strings.hrc>
#include <workwin.hxx>
#include <sfx2/sfxdlg.hxx>
+#include <sfx2/sfxbasemodel.hxx>
#include <appbaslib.hxx>
#include <openflag.hxx>
#include "objstor.hxx"
@@ -496,9 +497,16 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave )
{
// TODO/LATER: currently the application guards against the reentrance problem
SetModified(); // the modified flag has to be set to let the document be stored with the shared flag
- const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC );
- const SfxBoolItem* pResult = dynamic_cast<const SfxBoolItem*>( pItem );
- bResult = ( pResult && pResult->GetValue() );
+ try
+ {
+ // Do *not* use dispatch mechanism in this place - we don't want others (extensions etc.) to intercept this.
+ pImpl->pBaseModel->store();
+ bResult = true;
+ }
+ catch (...)
+ {
+ bResult = false;
+ }
}
}