diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 36ff7957f4bc..8bf26de44885 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -65,6 +65,8 @@ public: ::boost::scoped_ptr m_pBadness; LifecycleProxy(); ~LifecycleProxy(); + // commit the storages: necessary for writes to streams to take effect! + void commitStorages(); }; class COMPHELPER_DLLPUBLIC OStorageHelper diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index e429f2223069..773ec55440d7 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -551,6 +552,20 @@ LifecycleProxy::LifecycleProxy() : m_pBadness( new Impl() ) { } LifecycleProxy::~LifecycleProxy() { } +void LifecycleProxy::commitStorages() +{ + for (Impl::reverse_iterator iter = m_pBadness->rbegin(); + iter != m_pBadness->rend(); ++iter) // reverse order (outwards) + { + uno::Reference const xTransaction(*iter, + uno::UNO_QUERY); + if (xTransaction.is()) + { + xTransaction->commit(); + } + } +} + static void splitPath( std::vector &rElems, const ::rtl::OUString& rPath ) {