diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-08 15:26:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-09 07:04:14 +0100 |
commit | 850fb2ac2d89e68570db840bab65ac46df9d4314 (patch) | |
tree | 0b07fc45b10613482b8ad24305b351cb1995bcc4 /sd | |
parent | 16dbaf8e4a487c75f5977f5f4febdeae4466c264 (diff) |
use unique_ptr in sd
Change-Id: Ie212034c286146067c3ce49e62b2c47478ad7282
Reviewed-on: https://gerrit.libreoffice.org/65967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/drawdoc2.cxx | 3 | ||||
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 14 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 11 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 45 | ||||
-rw-r--r-- | sd/source/filter/sdpptwrp.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/animobjs.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/func/fuexpand.cxx | 37 | ||||
-rw-r--r-- | sd/source/ui/view/ToolBarManager.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 24 |
9 files changed, 68 insertions, 94 deletions
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index f4ecee1d518d..c8eeb6e0830a 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -1047,7 +1047,7 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject const * pObj, if ( auto pGrafObj = dynamic_cast< const SdrGrafObj *>( pObj ) ) // simple graphics object { const GeoStat& rGeo = pGrafObj->GetGeoStat(); - SdrGrafObjGeoData* pGeoData = static_cast<SdrGrafObjGeoData*>( pGrafObj->GetGeoData() ); + std::unique_ptr<SdrGrafObjGeoData> pGeoData(static_cast<SdrGrafObjGeoData*>( pGrafObj->GetGeoData() )); // Undo rotation if ( rGeo.nRotationAngle ) @@ -1067,7 +1067,6 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject const * pObj, aGraphSize = OutputDevice::LogicToLogic( pGrafObj->GetGrafPrefSize(), pGrafObj->GetGrafPrefMapMode(), aMap100 ); - delete pGeoData; bObjSupported = true; } else if ( auto pOleObj = dynamic_cast<const SdrOle2Obj* >(pObj) ) // OLE object diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 28217258aff2..1075d85bb14c 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1042,7 +1042,7 @@ bool SdDrawDocument::InsertBookmarkAsObject( if (pBMView) { // Insert selected objects - ::sd::View* pView = new ::sd::View(*this, nullptr); + std::unique_ptr<::sd::View> pView(new ::sd::View(*this, nullptr)); pView->EndListening(*this); // Look for the page into which the objects are supposed to be inserted @@ -1100,7 +1100,7 @@ bool SdDrawDocument::InsertBookmarkAsObject( if (!bOLEObjFound) delete pTmpDoc; // Would otherwise be destroyed by DocShell - delete pView; + pView.reset(); // Get number of objects after inserting. const size_t nCount = pPage->GetObjCount(); @@ -1471,19 +1471,17 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, if (pSourceDoc != this) { // #i121863# clone masterpages, they are from another model (!) - SdPage* pNewNotesMaster = dynamic_cast< SdPage* >(pNotesMaster->CloneSdrPage(*this)); - SdPage* pNewMaster = dynamic_cast< SdPage* >(pMaster->CloneSdrPage(*this)); + std::unique_ptr<SdPage> pNewNotesMaster(dynamic_cast< SdPage* >(pNotesMaster->CloneSdrPage(*this))); + std::unique_ptr<SdPage> pNewMaster(dynamic_cast< SdPage* >(pMaster->CloneSdrPage(*this))); if(!pNewNotesMaster || !pNewMaster) { - delete pNewNotesMaster; - delete pNewMaster; OSL_FAIL("SdDrawDocument::SetMasterPage() cloning of MasterPage/NoteAmsterPage failed!" ); return; } - pNotesMaster = pNewNotesMaster; - pMaster = pNewMaster; + pNotesMaster = pNewNotesMaster.release(); + pMaster = pNewMaster.release(); // layout name needs to be unique aTargetNewLayoutName = pMaster->GetLayoutName(); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index a6de2cb6556d..78adba107798 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2447,21 +2447,21 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO aString += rString; // check if we need to add a text field - SvxFieldData* pData = nullptr; + std::unique_ptr<SvxFieldData> pData; switch( eObjKind ) { case PRESOBJ_HEADER: - pData = new SvxHeaderField(); + pData.reset(new SvxHeaderField()); break; case PRESOBJ_FOOTER: - pData = new SvxFooterField(); + pData .reset(new SvxFooterField()); break; case PRESOBJ_SLIDENUMBER: - pData = new SvxPageField(); + pData.reset(new SvxPageField()); break; case PRESOBJ_DATETIME: - pData = new SvxDateTimeField(); + pData.reset(new SvxDateTimeField()); break; default: break; @@ -2472,7 +2472,6 @@ void SdPage::SetObjText(SdrTextObj* pObj, SdrOutliner* pOutliner, PresObjKind eO ESelection e; SvxFieldItem aField( *pData, EE_FEATURE_FIELD ); pOutl->QuickInsertField(aField,e); - delete pData; } } break; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index a48ea1e6d1b4..e6215a39e158 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1665,8 +1665,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a bool bSecOutl = false; sal_uInt32 nPObjects = 0; - SvMemoryStream* pClientTextBox = nullptr; - SvMemoryStream* pClientData = nullptr; + std::unique_ptr<SvMemoryStream> pClientTextBox; + std::unique_ptr<SvMemoryStream> pClientData; while( GetNextGroupEntry() ) { @@ -2687,7 +2687,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a mpExEmbed->SeekRel( nSize ); if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); pClientData->WriteUInt16( 0 ) .WriteUInt16( EPP_ExObjRefAtom ) .WriteUInt32( 4 ) @@ -2759,7 +2759,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } } if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); pClientData->WriteUInt32( EPP_OEPlaceholderAtom << 16 ).WriteUInt32( 8 ) .WriteInt32( nPlacementID ) // PlacementID @@ -2770,7 +2770,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( nOlePictureId ) { if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); pClientData->WriteUInt32( EPP_ExObjRefAtom << 16 ).WriteUInt32( 4 ) .WriteUInt32( nOlePictureId ); @@ -2778,20 +2778,20 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } if ( bEffect && !pClientData ) { - pClientData = new SvMemoryStream( 0x200, 0x200 ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); } if ( eCa != css::presentation::ClickAction_NONE ) { if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); ImplWriteClickAction( *pClientData, eCa, bMediaClickAction ); } } if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) ) { if ( !pClientTextBox ) - pClientTextBox = new SvMemoryStream( 0x200, 0x200 ); + pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 )); if ( !mbEmptyPresObj ) { @@ -2823,8 +2823,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( aExtBu.Tell() ) { if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); - ImplProgTagContainer( pClientData, &aExtBu ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); + ImplProgTagContainer( pClientData.get(), &aExtBu ); } } } @@ -2842,21 +2842,21 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a nInstance2 = EPP_TEXTTYPE_Other; // Text in a Shape if ( !pClientTextBox ) - pClientTextBox = new SvMemoryStream( 0x200, 0x200 ); + pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 )); SvMemoryStream aExtBu( 0x200, 0x200 ); ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, nullptr, aExtBu, &aPropOpt ); if ( aExtBu.Tell() ) { if ( !pClientData ) - pClientData = new SvMemoryStream( 0x200, 0x200 ); - ImplProgTagContainer( pClientData, &aExtBu ); + pClientData.reset(new SvMemoryStream( 0x200, 0x200 )); + ImplProgTagContainer( pClientData.get(), &aExtBu ); } } else if ( nPlaceHolderAtom >= 19 ) { if ( !pClientTextBox ) - pClientTextBox = new SvMemoryStream( 12 ); + pClientTextBox.reset(new SvMemoryStream( 12 )); pClientTextBox->WriteUInt32( EPP_TextHeaderAtom << 16 ).WriteUInt32( 4 ) .WriteUInt32( 7 ); @@ -2881,8 +2881,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a .WriteUInt32( pClientData->Tell() ); mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell()); - delete pClientData; - pClientData = nullptr; + pClientData.reset(); } if ( pClientTextBox ) { @@ -2890,8 +2889,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a .WriteUInt32( pClientTextBox->Tell() ); mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell()); - delete pClientTextBox; - pClientTextBox = nullptr; + pClientTextBox.reset(); } mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer } @@ -2940,7 +2938,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a // mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect ); } if ( !pClientTextBox ) - pClientTextBox = new SvMemoryStream( 0x200, 0x200 ); + pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 )); SvMemoryStream aExtBu( 0x200, 0x200 ); ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, nullptr, aExtBu, &aPropOpt ); @@ -2956,8 +2954,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a .WriteUInt32( pClientTextBox->Tell() ); mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell()); - delete pClientTextBox; - pClientTextBox = nullptr; + pClientTextBox.reset(); mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer @@ -3197,14 +3194,12 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha // need write client data for extend bullet if ( aExtBu.Tell() ) { - SvMemoryStream* pClientData = new SvMemoryStream( 0x200, 0x200 ); - ImplProgTagContainer( pClientData, &aExtBu ); + std::unique_ptr<SvMemoryStream> pClientData(new SvMemoryStream( 0x200, 0x200 )); + ImplProgTagContainer( pClientData.get(), &aExtBu ); mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf ) .WriteUInt32( pClientData->Tell() ); mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell()); - delete pClientData; - pClientData = nullptr; } aPropOptSp.Commit( *mpStrm ); diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index e2966aab3e8b..feb9adaa15c9 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -87,7 +87,7 @@ bool SdPPTFilter::Import() xDualStorage = pStorage->OpenSotStorage( sDualStorage, StreamMode::STD_READ ); pStorage = xDualStorage; } - SvStream* pDocStream = pStorage->OpenSotStream( "PowerPoint Document" , StreamMode::STD_READ ); + std::unique_ptr<SvStream> pDocStream(pStorage->OpenSotStream( "PowerPoint Document" , StreamMode::STD_READ )); if( pDocStream ) { pDocStream->SetVersion( pStorage->GetVersion() ); @@ -110,8 +110,6 @@ bool SdPPTFilter::Import() if ( !bRet ) mrMedium.SetError(SVSTREAM_WRONGVERSION); } - - delete pDocStream; } } diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index ace194fa00aa..9c1e9478bc05 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -278,14 +278,14 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, Button *, p, void ) } // StatusBarManager from 1 second - SfxProgress* pProgress = nullptr; + std::unique_ptr<SfxProgress> pProgress; if( nFullTime >= 1000 ) { bDisableCtrls = true; m_pBtnStop->Enable(); m_pBtnStop->Update(); OUString const aStr("Animator:"); // here we should think about something smart - pProgress = new SfxProgress( nullptr, aStr, nFullTime ); + pProgress.reset(new SfxProgress( nullptr, aStr, nFullTime )); } sal_uLong nTmpTime = 0; @@ -310,12 +310,12 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, Button *, p, void ) m_pTimeField->SetTime( rTime ); sal_uLong nTime = rTime.GetMSFromTime(); - WaitInEffect( nTime, nTmpTime, pProgress ); + WaitInEffect( nTime, nTmpTime, pProgress.get() ); nTmpTime += nTime; } else { - WaitInEffect( 100, nTmpTime, pProgress ); + WaitInEffect( 100, nTmpTime, pProgress.get() ); nTmpTime += 100; } if( bReverse ) @@ -353,7 +353,7 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, Button *, p, void ) if( pProgress ) { - delete pProgress; + pProgress.reset(); m_pBtnStop->Disable(); } diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx index 1ee4ead17558..d38479ca9d80 100644 --- a/sd/source/ui/func/fuexpand.cxx +++ b/sd/source/ui/func/fuexpand.cxx @@ -89,16 +89,15 @@ void FuExpandPage::DoExecute( SfxRequest& ) if (pActualPage) { - SdOutliner* pOutl = - new SdOutliner( mpDoc, OutlinerMode::OutlineObject ); - pOutl->SetUpdateMode(false); - pOutl->EnableUndo(false); + SdOutliner aOutliner( mpDoc, OutlinerMode::OutlineObject ); + aOutliner.SetUpdateMode(false); + aOutliner.EnableUndo(false); if (mpDocSh) - pOutl->SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); + aOutliner.SetRefDevice( SD_MOD()->GetVirtualRefDevice() ); - pOutl->SetDefTab( mpDoc->GetDefaultTabulator() ); - pOutl->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool())); + aOutliner.SetDefTab( mpDoc->GetDefaultTabulator() ); + aOutliner.SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool())); SdrLayerIDSet aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers(); sal_uInt16 nActualPageNum = pActualPage->GetPageNum(); @@ -114,25 +113,25 @@ void FuExpandPage::DoExecute( SfxRequest& ) // set current structuring-object into outliner OutlinerParaObject* pParaObj = pActualOutline->GetOutlinerParaObject(); - pOutl->SetText(*pParaObj); + aOutliner.SetText(*pParaObj); // remove hard paragraph- and character attributes SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{}); - sal_Int32 nParaCount1 = pOutl->GetParagraphCount(); + sal_Int32 nParaCount1 = aOutliner.GetParagraphCount(); for (sal_Int32 nPara = 0; nPara < nParaCount1; nPara++) { - pOutl->RemoveCharAttribs(nPara); - pOutl->SetParaAttribs(nPara, aEmptyEEAttr); + aOutliner.RemoveCharAttribs(nPara); + aOutliner.SetParaAttribs(nPara, aEmptyEEAttr); } sal_uInt16 nPos = 2; - Paragraph* pPara = pOutl->GetParagraph( 0 ); + Paragraph* pPara = aOutliner.GetParagraph( 0 ); while (pPara) { - sal_Int32 nParaPos = pOutl->GetAbsPos( pPara ); - sal_Int16 nDepth = pOutl->GetDepth( nParaPos ); + sal_Int32 nParaPos = aOutliner.GetAbsPos( pPara ); + sal_Int16 nDepth = aOutliner.GetDepth( nParaPos ); if ( nDepth == 0 ) { // page with title & structuring! @@ -186,7 +185,7 @@ void FuExpandPage::DoExecute( SfxRequest& ) if (!pTextObj) continue; - std::unique_ptr<OutlinerParaObject> pOutlinerParaObject = pOutl->CreateParaObject( nParaPos, 1); + std::unique_ptr<OutlinerParaObject> pOutlinerParaObject = aOutliner.CreateParaObject( nParaPos, 1); pOutlinerParaObject->SetOutlinerMode(OutlinerMode::TitleObject); if( pOutlinerParaObject->GetDepth(0) != -1 ) @@ -210,13 +209,13 @@ void FuExpandPage::DoExecute( SfxRequest& ) pTextObj->NbcSetStyleSheet(pSheet, false); SdrTextObj* pOutlineObj = nullptr; - sal_Int32 nChildCount = pOutl->GetChildCount(pPara); + sal_Int32 nChildCount = aOutliner.GetChildCount(pPara); if (nChildCount > 0) pOutlineObj = static_cast<SdrTextObj*>( pPage->GetPresObj(PRESOBJ_OUTLINE) ); if (pOutlineObj) { // create structuring text objects - std::unique_ptr<OutlinerParaObject> pOPO = pOutl->CreateParaObject(++nParaPos, nChildCount); + std::unique_ptr<OutlinerParaObject> pOPO = aOutliner.CreateParaObject(++nParaPos, nChildCount); std::unique_ptr<SdrOutliner> pTempOutl = SdrMakeOutliner(OutlinerMode::OutlineObject, *mpDoc); pTempOutl->SetText( *pOPO ); @@ -244,15 +243,13 @@ void FuExpandPage::DoExecute( SfxRequest& ) } } - pPara = pOutl->GetParagraph( ++nParaPos ); + pPara = aOutliner.GetParagraph( ++nParaPos ); } if( bUndo ) mpView->EndUndo(); } - delete pOutl; - mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE_PAGE, SfxCallMode::SYNCHRON | SfxCallMode::RECORD); } } diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 1f0cbdac0f95..55320e8fc407 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -804,12 +804,8 @@ void ToolBarManager::Implementation::Update ( mrBase.GetViewShellManager()); // 3) Unlock the ViewShellManager::UpdateLock. This updates the - // shell stack. We have to be carefully here. The deletion of - // the lock may end in a synchronous call to LockUpdate(). When - // at this time the lock has been deleted but the unique_ptr has - // not yet been reset then the lock is deleted a second time. - ViewShellManager::UpdateLock* pLock = mpViewShellManagerLock.release(); - delete pLock; + // shell stack. + mpViewShellManagerLock.reset(); // 4) Make the UNO tool bars visible. The outstanding call to // PostUpdate() is done via PostUserEvent() so that it is @@ -833,11 +829,7 @@ void ToolBarManager::Implementation::Update ( } else { - //do this in two steps, first clear mpViewShellManagerLock to be NULL - ViewShellManager::UpdateLock* pLock = mpViewShellManagerLock.release(); - //now delete the lock so reentry to this method triggered by this - //delete will encounter an empty mpViewShellManagerLock - delete pLock; + mpViewShellManagerLock.reset(); pLocalLayouterLock.reset(); } } diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 05b5f242f5ea..0b25afd4771d 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -104,12 +104,12 @@ struct ImpRememberOrigAndClone SdrObject* pClone; }; -static SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone*>& aConnectorContainer, SdrObject const * pConnObj) +static SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone>& aConnectorContainer, SdrObject const * pConnObj) { - for(ImpRememberOrigAndClone* p : aConnectorContainer) + for(ImpRememberOrigAndClone& rImp : aConnectorContainer) { - if(pConnObj == p->pOrig) - return p->pClone; + if(pConnObj == rImp.pOrig) + return rImp.pClone; } return nullptr; } @@ -458,7 +458,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, pMarkList->ForceSort(); // stuff to remember originals and clones - std::vector<ImpRememberOrigAndClone*> aConnectorContainer; + std::vector<ImpRememberOrigAndClone> aConnectorContainer; size_t nConnectorCount = 0; Point aCurPos; @@ -500,10 +500,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, EndUndo(); } - ImpRememberOrigAndClone* pRem = new ImpRememberOrigAndClone; - pRem->pOrig = pM->GetMarkedSdrObj(); - pRem->pClone = pObj; - aConnectorContainer.push_back(pRem); + ImpRememberOrigAndClone aRem; + aRem.pOrig = pM->GetMarkedSdrObj(); + aRem.pClone = pObj; + aConnectorContainer.push_back(aRem); if(dynamic_cast< SdrEdgeObj *>( pObj ) != nullptr) nConnectorCount++; @@ -515,7 +515,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { for(size_t a = 0; a < aConnectorContainer.size(); ++a) { - ImpRememberOrigAndClone* pRem = aConnectorContainer[a]; + ImpRememberOrigAndClone* pRem = &aConnectorContainer[a]; if(dynamic_cast< const SdrEdgeObj *>( pRem->pClone ) != nullptr) { @@ -589,10 +589,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - // cleanup remember classes - for(ImpRememberOrigAndClone* p : aConnectorContainer) - delete p; - if( pMarkList != mpDragSrcMarkList.get() ) delete pMarkList; |