diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-07-12 15:46:45 +1000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-07-15 09:07:17 +0200 |
commit | 68f5e5038147d8537e7046fc67b11157bb3064fe (patch) | |
tree | 75ffd101619e2039da6b2e5b9a4b5bee5a62cad7 | |
parent | a148813cec0c4da58686cac199a2de7d9b543b06 (diff) |
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@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/75496
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d814ed43e5a0..5eeeaddf8a42 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -493,10 +493,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( |