From 256371f49dad16347db48d7ff826779345538f3c Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 17 Mar 2015 20:19:40 +0000 Subject: clear() is the equivalent of assigning a local ptr to NULL. Sometimes it matters; doing a disposeAndClear() instead can change the order of destruction profoundly. Fix a number of issues from: "vclwidget: change all vcl::window fields to be wrapped in VclPtr" Change-Id: I3127d3ed973458e8299156453258e167dbdb8ccf --- avmedia/source/framework/mediacontrol.cxx | 2 +- basctl/source/basicide/basidesh.cxx | 6 ++++++ cui/source/factory/dlgfact.cxx | 5 ++++- cui/source/factory/dlgfact.hxx | 3 ++- sfx2/source/appl/childwin.cxx | 6 +++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index e6c680e45d3d..baf1acfe8949 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -202,7 +202,7 @@ MediaControl::~MediaControl() void MediaControl::dispose() { maZoomToolBox->SetItemWindow( AVMEDIA_TOOLBOXITEM_ZOOM, NULL ); - mpZoomListBox.disposeAndClear(); + mpZoomListBox.clear(); maTimeEdit.disposeAndClear(); maZoomToolBox.disposeAndClear(); maVolumeSlider.disposeAndClear(); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index d161f50f9bc6..58938a2cb837 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -232,6 +232,12 @@ Shell::~Shell() SetWindow( 0 ); SetCurWindow( 0 ); + for (WindowTable::iterator it = aWindowTable.begin(); it != aWindowTable.end(); ++it) + { + // no store; does already happen when the BasicManagers are destroyed + it->second.disposeAndClear(); + } + // no store; does already happen when the BasicManagers are destroyed aWindowTable.clear(); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 1210b8afd6df..a540534702ab 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -105,9 +105,11 @@ IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl); IMPL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl) IMPL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl) -AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl() \ +AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl() { + pDlg.disposeAndClear(); } + short AbstractSvxZoomDialog_Impl::Execute() { return pDlg->Execute(); @@ -153,6 +155,7 @@ IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl); // virtual VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl() { + m_pDlg.disposeAndClear(); } // virtual diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index d356bbab2181..98833f9a70be 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -72,8 +72,9 @@ public: \ #define IMPL_ABSTDLG_BASE(Class) \ Class::~Class() \ { \ + pDlg.disposeAndClear(); \ } \ -short Class::Execute() \ +short Class::Execute() \ { \ return pDlg->Execute(); \ } diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 1ec9b03fcd02..e1f2ecd40809 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -160,7 +160,6 @@ SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId) : pParent(pParentWindow) , nType(nId) , eChildAlignment(SfxChildAlignment::NOALIGNMENT) - , pWindow(0L) { pImp = new SfxChildWindow_Impl; pImp->pFact = 0L; @@ -199,6 +198,7 @@ void SfxChildWindow::Destroy() SfxChildWindow::~SfxChildWindow() { delete pContext; + pWindow.disposeAndClear(); delete pImp; } @@ -510,13 +510,13 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding } SfxChildWindowContext::SfxChildWindowContext( sal_uInt16 nId ) - : pWindow( NULL ) - , nContextId( nId ) + : nContextId( nId ) { } SfxChildWindowContext::~SfxChildWindowContext() { + pWindow.disposeAndClear(); } FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const -- cgit