diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-01-09 15:26:08 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 20:11:06 +0100 |
commit | 9a6bf4be437102004a01ee5818e943f0e095eefe (patch) | |
tree | b341a91c6983b9bb74052189bc06545549562e4f /vcl/source/window | |
parent | 04acdd8db4236e5cd4a89c3ca3e9049ff731b717 (diff) |
vcl: dispose of more Window sub-classes, particularly top-level windows.
Change-Id: If8311e5cf3193fd1434c3af5225367ca8e91fc6d
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/brdwin.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/btndlg.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/floatwin.cxx | 28 | ||||
-rw-r--r-- | vcl/source/window/introwin.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 20 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.cxx | 7 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.hxx | 3 | ||||
-rw-r--r-- | vcl/source/window/msgbox.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/openglwin.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/scrwnd.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/scrwnd.hxx | 3 | ||||
-rw-r--r-- | vcl/source/window/syschild.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/syswin.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/wrkwin.cxx | 6 |
16 files changed, 117 insertions, 22 deletions
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 882818fc0297..7f32e648d423 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1846,7 +1846,15 @@ ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle , ImplBorderWindow::~ImplBorderWindow() { + dispose(); +} + +void ImplBorderWindow::dispose() +{ delete mpBorderView; + mpBorderView = NULL; + + vcl::Window::dispose(); } void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt ) diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx index 515d17a20cc6..4c0e73cd0a09 100644 --- a/vcl/source/window/btndlg.cxx +++ b/vcl/source/window/btndlg.cxx @@ -59,11 +59,19 @@ ButtonDialog::ButtonDialog( vcl::Window* pParent, WinBits nStyle ) : ButtonDialog::~ButtonDialog() { + dispose(); +} + +void ButtonDialog::dispose() +{ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) { if ( it->mpPushButton && it->mbOwnButton ) delete it->mpPushButton; } + maItemList.clear(); + + Dialog::dispose(); } PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index b7834993f8b4..d53c91a2c3d5 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -538,6 +538,8 @@ void Dialog::settingOptimalLayoutSize(Window *pBox) Dialog::~Dialog() { + dispose(); + delete mpDialogImpl; mpDialogImpl = NULL; } diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 8ad024e1511f..06596b31b337 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -185,18 +185,30 @@ void FloatingWindow::doDeferredInit(WinBits nBits) FloatingWindow::~FloatingWindow() { - if( mbPopupModeCanceled ) - // indicates that ESC key was pressed - // will be handled in Window::ImplGrabFocus() - SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ); + dispose(); +} + +void FloatingWindow::dispose() +{ + if (mpImplData) + { + if( mbPopupModeCanceled ) + // indicates that ESC key was pressed + // will be handled in Window::ImplGrabFocus() + SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ); - if ( IsInPopupMode() ) - EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL ); + if ( IsInPopupMode() ) + EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL ); - if ( mnPostId ) - Application::RemoveUserEvent( mnPostId ); + if ( mnPostId ) + Application::RemoveUserEvent( mnPostId ); + mnPostId = 0; + } delete mpImplData; + mpImplData = NULL; + + SystemWindow::dispose(); } Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex ) diff --git a/vcl/source/window/introwin.cxx b/vcl/source/window/introwin.cxx index fa311d3129b5..4268f498e74b 100644 --- a/vcl/source/window/introwin.cxx +++ b/vcl/source/window/introwin.cxx @@ -40,6 +40,12 @@ IntroWindow::IntroWindow( ) : IntroWindow::~IntroWindow() { + dispose(); +} + +void IntroWindow::dispose() +{ + // FIXME: really we should have a dispose & a ref-ptr there [!] ... ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->mpIntroWindow == this ) pSVData->mpIntroWindow = NULL; diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 126e8b9be0b9..9e45c5d4cfb3 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -165,8 +165,19 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : MenuBarWindow::~MenuBarWindow() { + dispose(); +} + +void MenuBarWindow::dispose() +{ aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl)); RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener)); + + aCloseBtn.disposeAndClear(); + aFloatBtn.disposeAndClear(); + aHideBtn.disposeAndClear(); + + Window::dispose(); } void MenuBarWindow::SetMenu( MenuBar* pMen ) @@ -1057,15 +1068,6 @@ void MenuBarWindow::GetFocus() } } -void MenuBarWindow::dispose() -{ - aCloseBtn.disposeAndClear(); - aFloatBtn.disposeAndClear(); - aHideBtn.disposeAndClear(); - Window::dispose(); -} - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > MenuBarWindow::CreateAccessible() { ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc; diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx index 8b2e14d36fac..dcb68f31853f 100644 --- a/vcl/source/window/menubarwindow.hxx +++ b/vcl/source/window/menubarwindow.hxx @@ -105,11 +105,11 @@ private: void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; void LoseFocus() SAL_OVERRIDE; void GetFocus() SAL_OVERRIDE; - virtual void dispose() SAL_OVERRIDE; public: MenuBarWindow( vcl::Window* pParent ); - virtual ~MenuBarWindow(); + virtual ~MenuBarWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE; diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index e4b1124af4da..e6fe541c9371 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -104,7 +104,14 @@ void MenuFloatingWindow::doShutdown() MenuFloatingWindow::~MenuFloatingWindow() { + dispose(); +} + +void MenuFloatingWindow::dispose() +{ doShutdown(); + + FloatingWindow::dispose(); } void MenuFloatingWindow::Resize() diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx index 5e1b3437584d..3157be8d493f 100644 --- a/vcl/source/window/menufloatingwindow.hxx +++ b/vcl/source/window/menufloatingwindow.hxx @@ -80,7 +80,8 @@ protected: public: MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle ); - virtual ~MenuFloatingWindow(); + virtual ~MenuFloatingWindow(); + virtual void dispose() SAL_OVERRIDE; void doShutdown(); diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 2c68157e759c..b4c49b4dca11 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -151,9 +151,21 @@ MessBox::MessBox( vcl::Window* pParent, WinBits nStyle, MessBox::~MessBox() { + dispose(); +} + +void MessBox::dispose() +{ delete mpVCLMultiLineEdit; + mpVCLMultiLineEdit = NULL; + delete mpFixedImage; + mpFixedImage = NULL; + delete mpCheckBox; + mpCheckBox = NULL; + + ButtonDialog::dispose(); } void MessBox::ImplPosControls() diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx index 741940f45e2d..d026be2086f4 100644 --- a/vcl/source/window/openglwin.cxx +++ b/vcl/source/window/openglwin.cxx @@ -41,8 +41,16 @@ OpenGLWindow::OpenGLWindow(vcl::Window* pParent): OpenGLWindow::~OpenGLWindow() { + dispose(); +} + +void OpenGLWindow::dispose() +{ if(mpRenderer) mpRenderer->contextDestroyed(); + mpRenderer = NULL; + + Window::dispose(); } OpenGLContext& OpenGLWindow::getContext() diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index f03ce5a24fba..7d4b2325ebe2 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -84,8 +84,16 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) : ImplWheelWindow::~ImplWheelWindow() { + dispose(); +} + +void ImplWheelWindow::dispose() +{ ImplStop(); delete mpTimer; + mpTimer = NULL; + + FloatingWindow::dispose(); } void ImplWheelWindow::ImplStop() diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx index e71ca6d24676..5b297a24c41a 100644 --- a/vcl/source/window/scrwnd.hxx +++ b/vcl/source/window/scrwnd.hxx @@ -70,7 +70,8 @@ protected: public: ImplWheelWindow( vcl::Window* pParent ); - virtual ~ImplWheelWindow(); + virtual ~ImplWheelWindow(); + virtual void dispose() SAL_OVERRIDE; void ImplStop(); void ImplSetWheelMode( sal_uLong nWheelMode ); diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index f82e274d3c12..119bd1b0499e 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -133,12 +133,18 @@ SystemChildWindow::SystemChildWindow( vcl::Window* pParent, WinBits nStyle, Syst SystemChildWindow::~SystemChildWindow() { + dispose(); +} + +void SystemChildWindow::dispose() +{ Hide(); - if ( mpWindowImpl->mpSysObj ) + if ( mpWindowImpl && mpWindowImpl->mpSysObj ) { ImplGetSVData()->mpDefInst->DestroyObject( mpWindowImpl->mpSysObj ); mpWindowImpl->mpSysObj = NULL; } + Window::dispose(); } const SystemEnvData* SystemChildWindow::GetSystemData() const diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index c5d0522dc0e1..63bbd764be03 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -106,12 +106,20 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri SystemWindow::~SystemWindow() { + dispose(); +} + +void SystemWindow::dispose() +{ maLayoutIdle.Stop(); delete mpImplData; mpImplData = NULL; + // Hack to make sure code called from base ~Window does not interpret this // as a SystemWindow (which it no longer is by then): mpWindowImpl->mbSysWin = false; + + Window::dispose(); } bool SystemWindow::Notify( NotifyEvent& rNEvt ) diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 1f75bd63a5ec..4cdb9a553ec3 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -119,6 +119,12 @@ WorkWindow::~WorkWindow() pSVData->maWinData.mpAppWin = NULL; Application::Quit(); } + dispose(); +} + +void WorkWindow::dispose() +{ + SystemWindow::dispose(); } void WorkWindow::ShowFullScreenMode( bool bFullScreenMode ) |