path: root/svx/source/svdraw
diff options
authorDavid Tardon <>2013-05-16 15:27:08 +0200
committerPetr Mladek <>2013-05-28 15:13:22 +0000
commit7096efde95732b613dfa76df61a343b96ec6f979 (patch)
treeea30c9e4905b251de8c38715eb153e5341af13bf /svx/source/svdraw
parent686e0e1397e30b156a92505ed40de6cc71b34b0d (diff)
fdo#64279 do not crash opening report for editing
There are two problems: 1) The classes derived from SdrObject cache their SvxShape, but do not implement impl_setUnoShape(). 2) There is a lifetime issue in association of a SdrObject and its SvxShape. SvxDrawPage::CreateSdrObject not only creates a new SdrObject for a shape, but also inserts it into the page. At this point, the shape has not been attached to the object yet. That means that the object creates another shape at one point during the InsertObject call, which is then destroyed again. But reportdesign shapes own their objects, which means that destuction of the shape causes destruction of the object too... My first idea was to disable the insertion in SvxDrawPage::CreateSdrObject, but it has been there since the dawn of time, so I did not gather the courage to do that. Instead, I put in a hack to allow to skip the insertion. Change-Id: I888a54067be1934578434d8b476a13a7ff8d02b3 (cherry picked from commit 02d03eb4ad6e64744659c5fe04282b25b66c28d8) Signed-off-by: David Tardon <> Conflicts: include/svx/svdobj.hxx Change-Id: I36406f399092c2c85278633d2ee7c953fc76f1bc Reviewed-on: Reviewed-by: Petr Mladek <> Tested-by: Petr Mladek <>
Diffstat (limited to 'svx/source/svdraw')
1 files changed, 18 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f7045fe10864..e0efb3c4a6ce 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -422,6 +422,7 @@ SdrObject::SdrObject()
,mpSvxShape( NULL )
+ ,mbDoNotInsertIntoPageAutomatically(false)
bVirtObj =false;
@@ -496,6 +497,8 @@ SdrObject::~SdrObject()
delete mpViewContact;
mpViewContact = 0L;
+ mnLayerID = static_cast<SdrLayerID>(0xdead);
void SdrObject::Free( SdrObject*& _rpObject )
@@ -584,7 +587,11 @@ void SdrObject::SetPage(SdrPage* pNewPage)
// assume they create compatible UNO shape objects so we shouldn't have
// to invalidate.
if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == pModel))
- setUnoShape(NULL);
+ {
+ SvxShape* const pShape(getSvxShape());
+ if (pShape && !pShape->HasSdrObjectOwnership())
+ setUnoShape(NULL);
+ }
SdrPage* SdrObject::GetPage() const
@@ -3206,6 +3213,16 @@ void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/
// this base class does not support different writing modes, so ignore the call
+void SdrObject::SetDoNotInsertIntoPageAutomatically(const bool bSet)
+ mbDoNotInsertIntoPageAutomatically = bSet;
+bool SdrObject::IsDoNotInsertIntoPageAutomatically() const
+ return mbDoNotInsertIntoPageAutomatically;
SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel)