sd/source/ui/unoidl/unopage.cxx | 35 +++++++++++++++++++++++++++++++++++ xmloff/source/draw/ximpbody.cxx | 24 ++++++++++++++++++++++++ 2 files changed, 59 insertions(+)
New commits: commit 27db0b033235bb5379b5af4f530413750bee9f29 Author: Armin Le Grand <armin.le.gr...@cib.de> Date: Tue Jan 12 18:18:40 2016 +0100 tdf#96522 reset CustomShapeEngine at import Do not reset UNO API xShape at import time as described in tdf#93994, better reset the involved XCustomShapeEngine which allocates and holds the EditEngine and VirtualDevice. Resetting the UNO API object leads to problems when e.g. an animation effect is set for the shape. This happens since the animation effect remembers the xShape using a weak reference, thus being no real on-demand constructable object. Change-Id: I7b421f578ebf003af2745e449cd02ba368b455dd Reviewed-on: https://gerrit.libreoffice.org/21401 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 50f024844b1e00249e638df6db029f09465c4c10) Reviewed-on: https://gerrit.libreoffice.org/24842 Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 8dbb921..f7f1ecc 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -624,7 +624,15 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName if(pCustomShape) { - pCustomShape->setUnoShape(nullptr); + // tdf#96522 do not reset UNO API implementation since e.g. the + // animation evtl. added to the object uses weak references and + // will be lost when resetting it. In that sense it is *not* a + // on-demand recreatable ressource. + // Luckily, the object causing problems in tdf#93994 is not the + // UNO API object, but the XCustomShapeEngine involved. This + // object is on-demand replacable and can be reset here. This + // will free the involved EditEngine and VirtualDevice. + pCustomShape->mxCustomShapeEngine.set(nullptr); } } commit 67755e4a3b0634d123ad68b107381bf90b6d6487 Author: Armin Le Grand <armin.le.gr...@cib.de> Date: Wed Nov 18 15:37:26 2015 +0100 Resolves: tdf#93994 flush API objects at load time When importing SdrObjCustomShape for each an Outliner and a VirtualDevice as RefDevice are created and held. On 32bit systems this breaks the import with many such objects (in the bugdoc around 4300). On 64bit it works, but more memory as necessary is used. To avoid this, flush the UNO API implementations at these objects after one page is imported. Do not do this for each single object, that will break the connector import which does some processing later. Change-Id: I7296edd40f01c1a40258808d78bf39e6d4fe29bf Reviewed-on: https://gerrit.libreoffice.org/19990 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit e67a834c5d1a14889ab97b79df5b579934f27c30) Reviewed-on: https://gerrit.libreoffice.org/24841 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 98a9aa3..8dbb921 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -73,6 +73,7 @@ #include "unohelp.hxx" #include <vcl/dibtools.hxx> #include <svx/svdograf.hxx> +#include <svx/svdoashp.hxx> using ::com::sun::star::animations::XAnimationNode; using ::com::sun::star::animations::XAnimationNodeSupplier; @@ -605,6 +606,32 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName throwIfDisposed(); + // tdf#93994 Use a custom slot to have filter code flush the UNO + // API implementations of SdrObjCustomShape. Used e.g. by + // SdXMLDrawPageContext::EndElement(), see there for more + // information + if(SvxFmDrawPage::mpPage) + { + const OUString sFlushCustomShapeUnoApiObjects("FlushCustomShapeUnoApiObjects"); + + if(sFlushCustomShapeUnoApiObjects == aPropertyName) + { + SdrObjListIter aIter(static_cast< SdPage& >(*SvxFmDrawPage::mpPage), IM_DEEPWITHGROUPS); + + while(aIter.IsMore()) + { + SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >(aIter.Next()); + + if(pCustomShape) + { + pCustomShape->setUnoShape(nullptr); + } + } + + return; + } + } + const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); switch( pEntry ? pEntry->nWID : -1 ) diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index 2fea468..227280e 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -37,6 +37,7 @@ #include "PropertySetMerger.hxx" #include "animationimport.hxx" #include <tools/debug.hxx> +#include <osl/diagnose.hxx> using namespace ::com::sun::star; @@ -277,6 +278,29 @@ void SdXMLDrawPageContext::EndElement() if(xNodeSupplier.is()) xmloff::AnimationNodeContext::postProcessRootNode( GetSdImport(), xNodeSupplier->getAnimationNode(), xPageProps ); } + + // tdf#93994 call a custom slot to be able to reset the UNO API + // implementations held on the SdrObjects of type + // SdrObjCustomShape - those tend to linger until the entire file + // is loaded. For large files with a lot of these 32bit systems + // may crash due to being out of ressources after ca. 4200 + // Outliners and VirtualDevices used there as RefDevice + try + { + uno::Reference< beans::XPropertySet > xPropSet(GetLocalShapesContext(), uno::UNO_QUERY); + + if(xPropSet.is()) + { + const OUString sFlushCustomShapeUnoApiObjects("FlushCustomShapeUnoApiObjects"); + uno::Any aAny; + aAny <<= sal_True; + xPropSet->setPropertyValue(sFlushCustomShapeUnoApiObjects, aAny); + } + } + catch(const uno::Exception&) + { + OSL_FAIL("could not flush after load"); + } } SdXMLBodyContext::SdXMLBodyContext( SdXMLImport& rImport, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits