summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-14 21:47:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-15 09:06:59 +0200
commitc1676204447df942e766c0780c1580e1f0427b73 (patch)
tree4c91184869ef1aa291b4408aee14b724934ee8c5 /sfx2
parentb64ef8d113c1cc05c07b3d9fa25e34c7a98acf4a (diff)
tdf#117225 sfx2: fix leftover temp file when saving doc with embedded objects
Regression from 27938e1bbd5f3405c47b9933be7489eeb03920f3 (sfx2 store: create temp files next to local files (storage case), 2018-01-17), the optimization to store temp files during save next to the destination document (so that it can be renamed and not copied after writing the data successfully) causes problems when we have embedded objects. Avoid the problem by disabling this new optimization when the document has embedded objects. How to fix the actual root cause is not clear to me, I see that: - the SfxMedium::GetOutputStorage() call in SfxObjectShell::SaveTo_Impl() create a temp file - the SfxMedium::Commit() call in SfxObjectShell::SaveTo_Impl() tries to remove the file, which fails on Windows as there is an open file handle to that file - SfxObjectShell::SwitchChildrenPersistance() would close the storage, owning that open file handle, but it's too late So just go back to the previous behavior for now. Change-Id: I37259100d1ddf963c1f2d3b7bd9f460bc995815c Reviewed-on: https://gerrit.libreoffice.org/54340 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx11
-rw-r--r--sfx2/source/doc/objstor.cxx2
2 files changed, 13 insertions, 0 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index cd257837ef30..a589d1134d90 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -288,6 +288,8 @@ public:
// in this case the member will hold this information
SignatureState m_nSignatureState;
+ bool m_bHasEmbeddedObjects = false;
+
util::DateTime m_aDateTime;
explicit SfxMedium_Impl();
@@ -3525,6 +3527,10 @@ OUString GetLogicBase(std::unique_ptr<SfxMedium_Impl> const & pImpl)
aLogicBase.clear();
}
+ if (pImpl->m_bHasEmbeddedObjects)
+ // Embedded objects would mean a special base, ignore that.
+ aLogicBase.clear();
+
return aLogicBase;
}
}
@@ -3828,6 +3834,11 @@ void SfxMedium::SetCachedSignatureState_Impl( SignatureState nState )
pImpl->m_nSignatureState = nState;
}
+void SfxMedium::SetHasEmbeddedObjects(bool bHasEmbeddedObjects)
+{
+ pImpl->m_bHasEmbeddedObjects = bHasEmbeddedObjects;
+}
+
bool SfxMedium::HasStorage_Impl() const
{
return pImpl->xStorage.is();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 02b5d7bcb0c5..244de5869a34 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1239,7 +1239,9 @@ bool SfxObjectShell::SaveTo_Impl
// if the url is not provided ( means the document is based on a stream ) this code is not
// reachable.
rMedium.CloseAndRelease();
+ rMedium.SetHasEmbeddedObjects(GetEmbeddedObjectContainer().HasEmbeddedObjects());
rMedium.GetOutputStorage();
+ rMedium.SetHasEmbeddedObjects(false);
}
}
else if ( !bStorageBasedSource && !bStorageBasedTarget )