diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-18 08:33:14 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 11:59:25 +0100 |
commit | 0556598b35eb6d81fdaff04520f14202660f0333 (patch) | |
tree | 2fb64309bbd8e519f25b1e55824bad5513754e91 /sw/source/ui/index | |
parent | 7aa921cb53eedd0a107fbe9f75365adcce4d37d9 (diff) |
vclwidget: check for calling delete on subclasses of vcl::Window
Change-Id: I7fb7cf919e3f46dd03a18b1cb95fa881915f9642
Diffstat (limited to 'sw/source/ui/index')
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 456a151ea3c8..073fc004ff7f 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1625,13 +1625,8 @@ public: m_pParent(pTokenWin) { } -<<<<<<< HEAD - virtual ~SwTOXButton() { dispose(); } - virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); } -======= virtual ~SwTOXButton() { disposeOnce(); } - virtual void dispose() SAL_OVERRIDE { m_pParent.disposeAndClear(); PushButton::dispose(); } ->>>>>>> 82c89a6... vclwidget: only call dispose() once + virtual void dispose() SAL_OVERRIDE { m_pParent.clear(); PushButton::dispose(); } virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; @@ -2772,9 +2767,10 @@ void SwTokenWindow::dispose() { for (ctrl_iterator it = aControlList.begin(); it != aControlList.end(); ++it) { - it->SetGetFocusHdl( Link() ); - it->SetLoseFocusHdl( Link() ); - it->disposeAndClear(); + VclPtr<Control> pControl = (*it); + pControl->SetGetFocusHdl( Link() ); + pControl->SetLoseFocusHdl( Link() ); + pControl.disposeAndClear(); } aControlList.clear(); disposeBuilder(); @@ -3192,15 +3188,15 @@ void SwTokenWindow::RemoveControl(SwTOXButton* pDel, bool bInternalCall ) ctrl_iterator itLeft = it, itRight = it; --itLeft; ++itRight; - Control *pLeftEdit = *itLeft; - Control *pRightEdit = *itRight; + VclPtr<Control> pLeftEdit = *itLeft; + VclPtr<Control> pRightEdit = *itRight; - static_cast<SwTOXEdit*>(pLeftEdit)->SetText(static_cast<SwTOXEdit*>(pLeftEdit)->GetText() + - static_cast<SwTOXEdit*>(pRightEdit)->GetText()); - static_cast<SwTOXEdit*>(pLeftEdit)->AdjustSize(); + static_cast<SwTOXEdit*>(pLeftEdit.get())->SetText(static_cast<SwTOXEdit*>(pLeftEdit.get())->GetText() + + static_cast<SwTOXEdit*>(pRightEdit.get())->GetText()); + static_cast<SwTOXEdit*>(pLeftEdit.get())->AdjustSize(); aControlList.erase(itRight); - delete pRightEdit; + pRightEdit.disposeAndClear(); aControlList.erase(it); pActiveCtrl->Hide(); |