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
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index e6c680e..baf1acf 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 d161f50..58938a2 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 1210b8a..a540534 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 d356bbab..98833f9 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 1ec9b03..e1f2ecd 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