summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2017-02-14 19:09:30 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2017-02-14 19:10:24 +0100
commit3acdc0a0fca421addde76da36b156af70c234939 (patch)
tree99b230001daf8a513ff1afa6de14b95634a991a7 /sw/source
parented4b23548d28941f9b2c75207832afcb6c6ad0b3 (diff)
Revert commits that caused instability on the Linux debug tinderbox
Revert "DYING_FLYFRAMEFORMAT not needed anymore" This reverts commit 837545feb63f31095d69d006aeda520637c3bc8c. Revert "give SwFlyDrawContact a clear owner: SwFlyFrameFormat" This reverts commit 4ae93f7d3b063d13ff757884444a468212227ef9.
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/draw/dcontact.cxx11
-rw-r--r--sw/source/core/layout/atrfrm.cxx16
-rw-r--r--sw/source/core/layout/fly.cxx19
-rw-r--r--sw/source/core/unocore/unoframe.cxx19
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx17
5 files changed, 45 insertions, 37 deletions
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 9a4c78eb3d18..6d2c08ba0b51 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -594,6 +594,17 @@ void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint
{
pKillDrawHint->m_rpContact = this;
}
+ else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
+ {
+ switch(pDrawFrameFormatHint->m_eId)
+ {
+ case sw::DrawFrameFormatHintId::DYING_FLYFRAMEFORMAT:
+ delete this;
+ break;
+ default:
+ ;
+ }
+ }
}
// SwDrawContact
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 01c59236a505..1b420b73d0ba 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2866,20 +2866,6 @@ void SwFrameFormats::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) cons
IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrameFormat )
-SwFlyFrameFormat::SwFlyFrameFormat(SwAttrPool& rPool, const OUString& rFormatNm, SwFrameFormat* pDrvdFrame)
- : SwFrameFormat(rPool, rFormatNm, pDrvdFrame, RES_FLYFRMFMT)
- , m_pContact(nullptr)
-{}
-
-void SwFlyFrameFormat::InitContact(SdrModel* pSdrModel)
-{
- m_pContact = std::unique_ptr<SwFlyDrawContact>(new SwFlyDrawContact(this, pSdrModel));
-}
-void SwFlyFrameFormat::ClearContact()
-{
- m_pContact.reset(nullptr);
-}
-
SwFlyFrameFormat::~SwFlyFrameFormat()
{
SwIterator<SwFlyFrame,SwFormat> aIter( *this );
@@ -2889,6 +2875,8 @@ SwFlyFrameFormat::~SwFlyFrameFormat()
{
SwFrame::DestroyFrame(pLast);
} while( nullptr != ( pLast = aIter.Next() ));
+
+ CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::DYING_FLYFRAMEFORMAT));
}
/// Creates the Frames if the format describes a paragraph-bound frame.
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 6e8cf9426d5e..55f1ac2d5c8d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -397,21 +397,25 @@ void SwFlyFrame::InitDrawObj()
// need to create a new Ref, else we create the Contact now.
IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess();
- if(!GetFormat()->GetContact())
+ SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFormat>( *GetFormat() ).First();
+ if ( !pContact )
{
// #i52858# - method name changed
- GetFormat()->InitContact(rIDDMA.GetOrCreateDrawModel());
+ pContact = new SwFlyDrawContact( GetFormat(),
+ rIDDMA.GetOrCreateDrawModel() );
}
- OSL_ENSURE(GetFormat()->GetContact(), "InitDrawObj failed");
+ OSL_ENSURE( pContact, "InitDrawObj failed" );
// OD 2004-03-22 #i26791#
- SetDrawObj( *(CreateNewRef( GetFormat()->GetContact() )) );
+ SetDrawObj( *(CreateNewRef( pContact )) );
// Set the right Layer
// OD 2004-01-19 #110582#
+ SdrLayerID nHeavenId = rIDDMA.GetHeavenId();
+ SdrLayerID nHellId = rIDDMA.GetHellId();
// OD 2004-03-22 #i26791#
- GetVirtDrawObj()->SetLayer(GetFormat()->GetOpaque().GetValue()
- ? rIDDMA.GetHeavenId()
- : rIDDMA.GetHellId());
+ GetVirtDrawObj()->SetLayer( GetFormat()->GetOpaque().GetValue()
+ ? nHeavenId
+ : nHellId );
}
void SwFlyFrame::FinitDrawObj()
@@ -455,6 +459,7 @@ void SwFlyFrame::FinitDrawObj()
pContact->GetMaster()->SetUserCall(nullptr);
GetVirtDrawObj()->SetUserCall(nullptr); // Else calls delete of the ContactObj
delete GetVirtDrawObj(); // Deregisters itself at the Master
+ delete pContact; // Destroys the Master itself
}
void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow )
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 580522eceb28..4101171cab48 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1360,20 +1360,23 @@ void SwXFrame::SetSelection(SwPaM& rCopySource)
SdrObject *SwXFrame::GetOrCreateSdrObject(SwFlyFrameFormat &rFormat)
{
SdrObject* pObject = rFormat.FindSdrObject();
- if(!pObject)
+ if( !pObject )
{
- SwDoc* pDoc = rFormat.GetDoc();
+ SwDoc *pDoc = rFormat.GetDoc();
// #i52858# - method name changed
SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
- rFormat.InitContact(pDrawModel);
- pObject = rFormat.GetContact()->GetMaster();
+ SwFlyDrawContact* pContactObject
+ = new SwFlyDrawContact( &rFormat, pDrawModel );
+ pObject = pContactObject->GetMaster();
const ::SwFormatSurround& rSurround = rFormat.GetSurround();
- pObject->SetLayer((SURROUND_THROUGHT == rSurround.GetSurround() && !rFormat.GetOpaque().GetValue())
- ? pDoc->getIDocumentDrawModelAccess().GetHellId()
- : pDoc->getIDocumentDrawModelAccess().GetHeavenId());
- pDrawModel->GetPage(0)->InsertObject(pObject);
+ pObject->SetLayer(
+ ( SURROUND_THROUGHT == rSurround.GetSurround() &&
+ !rFormat.GetOpaque().GetValue() ) ? pDoc->getIDocumentDrawModelAccess().GetHellId()
+ : pDoc->getIDocumentDrawModelAccess().GetHeavenId() );
+ pDrawModel->GetPage(0)->InsertObject( pObject );
}
+
return pObject;
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 279960fccaff..3bd74491fcbf 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2131,18 +2131,19 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
}
}
-SdrObject* SwWW8ImplReader::CreateContactObject(SwFrameFormat* pFormat)
+SdrObject* SwWW8ImplReader::CreateContactObject(SwFrameFormat* pFlyFormat)
{
- if(pFormat)
+ if (pFlyFormat)
{
- SdrObject* pNewObject = m_bNewDoc ? nullptr : pFormat->FindRealSdrObject();
+ SdrObject* pNewObject = m_bNewDoc ? nullptr : pFlyFormat->FindRealSdrObject();
if (!pNewObject)
- pNewObject = pFormat->FindSdrObject();
- SwFlyFrameFormat* pFlyFormat(nullptr);
- if (!pNewObject && (pFlyFormat = dynamic_cast<SwFlyFrameFormat*>(pFormat)))
+ pNewObject = pFlyFormat->FindSdrObject();
+ if (!pNewObject && dynamic_cast< const SwFlyFrameFormat *>( pFlyFormat ) != nullptr)
{
- pFlyFormat->InitContact(m_pDrawModel);
- pNewObject = pFlyFormat->GetContact()->GetMaster();
+ SwFlyDrawContact* pContactObject
+ = new SwFlyDrawContact(static_cast<SwFlyFrameFormat*>(pFlyFormat),
+ m_pDrawModel);
+ pNewObject = pContactObject->GetMaster();
}
return pNewObject;
}