[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sfx2/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 15 09:31:32 UTC 2019
sfx2/source/view/viewfrm.cxx | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
New commits:
commit db5c6dbf3da3e99f045c98fcc122a6c0623bfbc4
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jul 12 15:46:45 2019 +1000
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Jul 15 11:30:48 2019 +0200
tdf#126241: make sure to fill input stream before LockOrigFileOnDemand
Otherwise, the function returns early, without providing lock file
information to the caller.
Change-Id: I1740ff0f5a982f7b22f9e3dcdf97631ab6ea6fe0
Reviewed-on: https://gerrit.libreoffice.org/75465
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit 60dffd80468e5ca4471bc67d02c58c8c784a86f1)
Reviewed-on: https://gerrit.libreoffice.org/75612
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 7aeac3d8f066..ee298b2bc55c 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -483,10 +483,21 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
pMed->CloseAndRelease();
- pMed->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, !( nOpenMode & StreamMode::WRITE ) ) );
pMed->SetOpenMode( nOpenMode );
-
+ // We need to clear the SID_DOC_READONLY item from the set, to allow
+ // MediaDescriptor::impl_openStreamWithURL (called indirectly by
+ // SfxMedium::CompleteReOpen) to properly fill input stream of the
+ // descriptor, even when the file can't be open in read-write mode.
+ // Only then can following call to SfxMedium::LockOrigFileOnDemand
+ // return proper information about who has locked the file, to show
+ // in the SfxQueryOpenAsTemplate box below; otherwise it exits right
+ // after call to SfxMedium::GetMedium_Impl. This mimics what happens
+ // when the file is opened initially, when filter detection code also
+ // calls MediaDescriptor::impl_openStreamWithURL without the item set.
+ pMed->GetItemSet()->ClearItem(SID_DOC_READONLY);
pMed->CompleteReOpen();
+ pMed->GetItemSet()->Put(
+ SfxBoolItem(SID_DOC_READONLY, !(nOpenMode & StreamMode::WRITE)));
if ( nOpenMode & StreamMode::WRITE )
{
auto eResult = pMed->LockOrigFileOnDemand(
More information about the Libreoffice-commits
mailing list