Kaydet (Commit) 9a6bf4be authored tarafından Michael Meeks's avatar Michael Meeks

vcl: dispose of more Window sub-classes, particularly top-level windows.

Change-Id: If8311e5cf3193fd1434c3af5225367ca8e91fc6d
üst 04acdd8d
...@@ -40,6 +40,7 @@ class VCL_DLLPUBLIC ButtonDialog : public Dialog ...@@ -40,6 +40,7 @@ class VCL_DLLPUBLIC ButtonDialog : public Dialog
public: public:
ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
virtual ~ButtonDialog(); virtual ~ButtonDialog();
virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
......
...@@ -122,6 +122,7 @@ public: ...@@ -122,6 +122,7 @@ public:
explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
virtual ~FloatingWindow(); virtual ~FloatingWindow();
virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
......
...@@ -30,8 +30,10 @@ private: ...@@ -30,8 +30,10 @@ private:
SAL_DLLPRIVATE void ImplInitIntroWindowData(); SAL_DLLPRIVATE void ImplInitIntroWindowData();
public: public:
IntroWindow(); IntroWindow();
virtual ~IntroWindow(); virtual ~IntroWindow();
virtual void dispose() SAL_OVERRIDE;
}; };
#endif // INCLUDED_VCL_INTROWIN_HXX #endif // INCLUDED_VCL_INTROWIN_HXX
......
...@@ -48,7 +48,8 @@ protected: ...@@ -48,7 +48,8 @@ protected:
public: public:
MessBox( vcl::Window* pParent, WinBits nStyle, MessBox( vcl::Window* pParent, WinBits nStyle,
const OUString& rTitle, const OUString& rMessage ); const OUString& rTitle, const OUString& rMessage );
virtual ~MessBox(); virtual ~MessBox();
virtual void dispose() SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
......
...@@ -33,8 +33,10 @@ public: ...@@ -33,8 +33,10 @@ public:
class VCLOPENGL_DLLPUBLIC OpenGLWindow : public vcl::Window class VCLOPENGL_DLLPUBLIC OpenGLWindow : public vcl::Window
{ {
public: public:
OpenGLWindow(vcl::Window* pParent); OpenGLWindow(vcl::Window* pParent);
virtual ~OpenGLWindow(); virtual ~OpenGLWindow();
virtual void dispose() SAL_OVERRIDE;
OpenGLContext& getContext(); OpenGLContext& getContext();
void setRenderer(IRenderer* pRenderer); void setRenderer(IRenderer* pRenderer);
......
...@@ -42,6 +42,7 @@ public: ...@@ -42,6 +42,7 @@ public:
// create a SystemChildWindow using the given SystemWindowData // create a SystemChildWindow using the given SystemWindowData
explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true ); explicit SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true );
virtual ~SystemChildWindow(); virtual ~SystemChildWindow();
virtual void dispose() SAL_OVERRIDE;
const SystemEnvData* GetSystemData() const; const SystemEnvData* GetSystemData() const;
......
...@@ -172,7 +172,9 @@ protected: ...@@ -172,7 +172,9 @@ protected:
SAL_DLLPRIVATE void DoInitialLayout(); SAL_DLLPRIVATE void DoInitialLayout();
public: public:
virtual ~SystemWindow(); virtual ~SystemWindow();
virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
......
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
explicit WorkWindow( vcl::Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK ); explicit WorkWindow( vcl::Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle = WB_STDWORK );
explicit WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version explicit WorkWindow( SystemParentData* pParent ); // Not in the REMOTE-Version
virtual ~WorkWindow(); virtual ~WorkWindow();
virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE; virtual bool Close() SAL_OVERRIDE;
......
...@@ -83,14 +83,14 @@ class ImplBorderWindow : public vcl::Window ...@@ -83,14 +83,14 @@ class ImplBorderWindow : public vcl::Window
private: private:
ImplBorderWindowView* mpBorderView; ImplBorderWindowView* mpBorderView;
vcl::Window* mpMenuBarWindow; vcl::Window* mpMenuBarWindow;
long mnMinWidth; long mnMinWidth;
long mnMinHeight; long mnMinHeight;
long mnMaxWidth; long mnMaxWidth;
long mnMaxHeight; long mnMaxHeight;
long mnRollHeight; long mnRollHeight;
long mnOrgMenuHeight; long mnOrgMenuHeight;
sal_uInt16 mnTitleType; sal_uInt16 mnTitleType;
WindowBorderStyle mnBorderStyle; WindowBorderStyle mnBorderStyle;
bool mbFloatWindow; bool mbFloatWindow;
bool mbSmallOutBorder; bool mbSmallOutBorder;
...@@ -121,7 +121,8 @@ public: ...@@ -121,7 +121,8 @@ public:
sal_uInt16 nTypeStyle = 0 ); sal_uInt16 nTypeStyle = 0 );
ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0, ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0,
sal_uInt16 nTypeStyle = 0 ); sal_uInt16 nTypeStyle = 0 );
virtual ~ImplBorderWindow(); virtual ~ImplBorderWindow();
virtual void dispose() SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
......
...@@ -1845,8 +1845,16 @@ ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle , ...@@ -1845,8 +1845,16 @@ ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle ,
} }
ImplBorderWindow::~ImplBorderWindow() ImplBorderWindow::~ImplBorderWindow()
{
dispose();
}
void ImplBorderWindow::dispose()
{ {
delete mpBorderView; delete mpBorderView;
mpBorderView = NULL;
vcl::Window::dispose();
} }
void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt ) void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt )
......
...@@ -58,12 +58,20 @@ ButtonDialog::ButtonDialog( vcl::Window* pParent, WinBits nStyle ) : ...@@ -58,12 +58,20 @@ ButtonDialog::ButtonDialog( vcl::Window* pParent, WinBits nStyle ) :
} }
ButtonDialog::~ButtonDialog() ButtonDialog::~ButtonDialog()
{
dispose();
}
void ButtonDialog::dispose()
{ {
for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it) for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{ {
if ( it->mpPushButton && it->mbOwnButton ) if ( it->mpPushButton && it->mbOwnButton )
delete it->mpPushButton; delete it->mpPushButton;
} }
maItemList.clear();
Dialog::dispose();
} }
PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags )
......
...@@ -538,6 +538,8 @@ void Dialog::settingOptimalLayoutSize(Window *pBox) ...@@ -538,6 +538,8 @@ void Dialog::settingOptimalLayoutSize(Window *pBox)
Dialog::~Dialog() Dialog::~Dialog()
{ {
dispose();
delete mpDialogImpl; delete mpDialogImpl;
mpDialogImpl = NULL; mpDialogImpl = NULL;
} }
......
...@@ -185,18 +185,30 @@ void FloatingWindow::doDeferredInit(WinBits nBits) ...@@ -185,18 +185,30 @@ void FloatingWindow::doDeferredInit(WinBits nBits)
FloatingWindow::~FloatingWindow() FloatingWindow::~FloatingWindow()
{ {
if( mbPopupModeCanceled ) dispose();
// indicates that ESC key was pressed }
// will be handled in Window::ImplGrabFocus()
SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ); 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() ) if ( IsInPopupMode() )
EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL ); EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL );
if ( mnPostId ) if ( mnPostId )
Application::RemoveUserEvent( mnPostId ); Application::RemoveUserEvent( mnPostId );
mnPostId = 0;
}
delete mpImplData; delete mpImplData;
mpImplData = NULL;
SystemWindow::dispose();
} }
Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex ) Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex )
......
...@@ -40,6 +40,12 @@ IntroWindow::IntroWindow( ) : ...@@ -40,6 +40,12 @@ IntroWindow::IntroWindow( ) :
IntroWindow::~IntroWindow() IntroWindow::~IntroWindow()
{ {
dispose();
}
void IntroWindow::dispose()
{
// FIXME: really we should have a dispose & a ref-ptr there [!] ...
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->mpIntroWindow == this ) if ( pSVData->mpIntroWindow == this )
pSVData->mpIntroWindow = NULL; pSVData->mpIntroWindow = NULL;
......
...@@ -164,9 +164,20 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : ...@@ -164,9 +164,20 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
} }
MenuBarWindow::~MenuBarWindow() MenuBarWindow::~MenuBarWindow()
{
dispose();
}
void MenuBarWindow::dispose()
{ {
aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl)); aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener)); RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener));
aCloseBtn.disposeAndClear();
aFloatBtn.disposeAndClear();
aHideBtn.disposeAndClear();
Window::dispose();
} }
void MenuBarWindow::SetMenu( MenuBar* pMen ) void MenuBarWindow::SetMenu( MenuBar* pMen )
...@@ -1057,15 +1068,6 @@ void MenuBarWindow::GetFocus() ...@@ -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 > MenuBarWindow::CreateAccessible()
{ {
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc;
......
...@@ -105,11 +105,11 @@ private: ...@@ -105,11 +105,11 @@ private:
void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
void LoseFocus() SAL_OVERRIDE; void LoseFocus() SAL_OVERRIDE;
void GetFocus() SAL_OVERRIDE; void GetFocus() SAL_OVERRIDE;
virtual void dispose() SAL_OVERRIDE;
public: public:
MenuBarWindow( vcl::Window* pParent ); MenuBarWindow( vcl::Window* pParent );
virtual ~MenuBarWindow(); virtual ~MenuBarWindow();
virtual void dispose() SAL_OVERRIDE;
virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE; virtual void ShowButtons(bool bClose, bool bFloat, bool bHide) SAL_OVERRIDE;
......
...@@ -103,8 +103,15 @@ void MenuFloatingWindow::doShutdown() ...@@ -103,8 +103,15 @@ void MenuFloatingWindow::doShutdown()
} }
MenuFloatingWindow::~MenuFloatingWindow() MenuFloatingWindow::~MenuFloatingWindow()
{
dispose();
}
void MenuFloatingWindow::dispose()
{ {
doShutdown(); doShutdown();
FloatingWindow::dispose();
} }
void MenuFloatingWindow::Resize() void MenuFloatingWindow::Resize()
......
...@@ -80,7 +80,8 @@ protected: ...@@ -80,7 +80,8 @@ protected:
public: public:
MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle ); MenuFloatingWindow( Menu* pMenu, vcl::Window* pParent, WinBits nStyle );
virtual ~MenuFloatingWindow(); virtual ~MenuFloatingWindow();
virtual void dispose() SAL_OVERRIDE;
void doShutdown(); void doShutdown();
......
...@@ -150,10 +150,22 @@ MessBox::MessBox( vcl::Window* pParent, WinBits nStyle, ...@@ -150,10 +150,22 @@ MessBox::MessBox( vcl::Window* pParent, WinBits nStyle,
} }
MessBox::~MessBox() MessBox::~MessBox()
{
dispose();
}
void MessBox::dispose()
{ {
delete mpVCLMultiLineEdit; delete mpVCLMultiLineEdit;
mpVCLMultiLineEdit = NULL;
delete mpFixedImage; delete mpFixedImage;
mpFixedImage = NULL;
delete mpCheckBox; delete mpCheckBox;
mpCheckBox = NULL;
ButtonDialog::dispose();
} }
void MessBox::ImplPosControls() void MessBox::ImplPosControls()
......
...@@ -40,9 +40,17 @@ OpenGLWindow::OpenGLWindow(vcl::Window* pParent): ...@@ -40,9 +40,17 @@ OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
} }
OpenGLWindow::~OpenGLWindow() OpenGLWindow::~OpenGLWindow()
{
dispose();
}
void OpenGLWindow::dispose()
{ {
if(mpRenderer) if(mpRenderer)
mpRenderer->contextDestroyed(); mpRenderer->contextDestroyed();
mpRenderer = NULL;
Window::dispose();
} }
OpenGLContext& OpenGLWindow::getContext() OpenGLContext& OpenGLWindow::getContext()
......
...@@ -83,9 +83,17 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) : ...@@ -83,9 +83,17 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
} }
ImplWheelWindow::~ImplWheelWindow() ImplWheelWindow::~ImplWheelWindow()
{
dispose();
}
void ImplWheelWindow::dispose()
{ {
ImplStop(); ImplStop();
delete mpTimer; delete mpTimer;
mpTimer = NULL;
FloatingWindow::dispose();
} }
void ImplWheelWindow::ImplStop() void ImplWheelWindow::ImplStop()
......
...@@ -70,7 +70,8 @@ protected: ...@@ -70,7 +70,8 @@ protected:
public: public:
ImplWheelWindow( vcl::Window* pParent ); ImplWheelWindow( vcl::Window* pParent );
virtual ~ImplWheelWindow(); virtual ~ImplWheelWindow();
virtual void dispose() SAL_OVERRIDE;
void ImplStop(); void ImplStop();
void ImplSetWheelMode( sal_uLong nWheelMode ); void ImplSetWheelMode( sal_uLong nWheelMode );
......
...@@ -132,13 +132,19 @@ SystemChildWindow::SystemChildWindow( vcl::Window* pParent, WinBits nStyle, Syst ...@@ -132,13 +132,19 @@ SystemChildWindow::SystemChildWindow( vcl::Window* pParent, WinBits nStyle, Syst
} }
SystemChildWindow::~SystemChildWindow() SystemChildWindow::~SystemChildWindow()
{
dispose();
}
void SystemChildWindow::dispose()
{ {
Hide(); Hide();
if ( mpWindowImpl->mpSysObj ) if ( mpWindowImpl && mpWindowImpl->mpSysObj )
{ {
ImplGetSVData()->mpDefInst->DestroyObject( mpWindowImpl->mpSysObj ); ImplGetSVData()->mpDefInst->DestroyObject( mpWindowImpl->mpSysObj );
mpWindowImpl->mpSysObj = NULL; mpWindowImpl->mpSysObj = NULL;
} }
Window::dispose();
} }
const SystemEnvData* SystemChildWindow::GetSystemData() const const SystemEnvData* SystemChildWindow::GetSystemData() const
......
...@@ -105,13 +105,21 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri ...@@ -105,13 +105,21 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri
} }
SystemWindow::~SystemWindow() SystemWindow::~SystemWindow()
{
dispose();
}
void SystemWindow::dispose()
{ {
maLayoutIdle.Stop(); maLayoutIdle.Stop();
delete mpImplData; delete mpImplData;
mpImplData = NULL; mpImplData = NULL;
// Hack to make sure code called from base ~Window does not interpret this // Hack to make sure code called from base ~Window does not interpret this
// as a SystemWindow (which it no longer is by then): // as a SystemWindow (which it no longer is by then):
mpWindowImpl->mbSysWin = false; mpWindowImpl->mbSysWin = false;
Window::dispose();
} }
bool SystemWindow::Notify( NotifyEvent& rNEvt ) bool SystemWindow::Notify( NotifyEvent& rNEvt )
......
...@@ -119,6 +119,12 @@ WorkWindow::~WorkWindow() ...@@ -119,6 +119,12 @@ WorkWindow::~WorkWindow()
pSVData->maWinData.mpAppWin = NULL; pSVData->maWinData.mpAppWin = NULL;
Application::Quit(); Application::Quit();
} }
dispose();
}
void WorkWindow::dispose()
{
SystemWindow::dispose();
} }
void WorkWindow::ShowFullScreenMode( bool bFullScreenMode ) void WorkWindow::ShowFullScreenMode( bool bFullScreenMode )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment