[Libreoffice-commits] core.git: Branch 'feature/vclref' - include/vcl vcl/inc vcl/source

Michael Meeks michael.meeks at collabora.com
Fri Jan 9 07:24:02 PST 2015


 include/vcl/btndlg.hxx                   |    1 +
 include/vcl/floatwin.hxx                 |    1 +
 include/vcl/introwin.hxx                 |    6 ++++--
 include/vcl/msgbox.hxx                   |    3 ++-
 include/vcl/openglwin.hxx                |    6 ++++--
 include/vcl/syschild.hxx                 |    1 +
 include/vcl/syswin.hxx                   |    4 +++-
 include/vcl/wrkwin.hxx                   |    1 +
 vcl/inc/brdwin.hxx                       |    7 ++++---
 vcl/source/window/brdwin.cxx             |    8 ++++++++
 vcl/source/window/btndlg.cxx             |    8 ++++++++
 vcl/source/window/dialog.cxx             |    2 ++
 vcl/source/window/floatwin.cxx           |   28 ++++++++++++++++++++--------
 vcl/source/window/introwin.cxx           |    6 ++++++
 vcl/source/window/menubarwindow.cxx      |   20 +++++++++++---------
 vcl/source/window/menubarwindow.hxx      |    4 ++--
 vcl/source/window/menufloatingwindow.cxx |    7 +++++++
 vcl/source/window/menufloatingwindow.hxx |    3 ++-
 vcl/source/window/msgbox.cxx             |   12 ++++++++++++
 vcl/source/window/openglwin.cxx          |    8 ++++++++
 vcl/source/window/scrwnd.cxx             |    8 ++++++++
 vcl/source/window/scrwnd.hxx             |    3 ++-
 vcl/source/window/syschild.cxx           |    8 +++++++-
 vcl/source/window/syswin.cxx             |    7 +++++++
 vcl/source/window/wrkwin.cxx             |    6 ++++++
 25 files changed, 137 insertions(+), 31 deletions(-)

New commits:
commit 7a62614fc4dca7caa370ee0dbad3262bb2f16a74
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jan 9 15:26:08 2015 +0000

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

diff --git a/include/vcl/btndlg.hxx b/include/vcl/btndlg.hxx
index 81df3d1..f2dc995 100644
--- a/include/vcl/btndlg.hxx
+++ b/include/vcl/btndlg.hxx
@@ -40,6 +40,7 @@ class VCL_DLLPUBLIC ButtonDialog : public Dialog
 public:
                         ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
     virtual             ~ButtonDialog();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        Resize() SAL_OVERRIDE;
     virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 5ad30a7..ae1e1f6 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -123,6 +123,7 @@ public:
     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>());
     virtual         ~FloatingWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
diff --git a/include/vcl/introwin.hxx b/include/vcl/introwin.hxx
index 7b9fc1e..8576ecd 100644
--- a/include/vcl/introwin.hxx
+++ b/include/vcl/introwin.hxx
@@ -30,8 +30,10 @@ private:
     SAL_DLLPRIVATE void ImplInitIntroWindowData();
 
 public:
-    IntroWindow();
-    virtual ~IntroWindow();
+                 IntroWindow();
+    virtual      ~IntroWindow();
+    virtual void dispose() SAL_OVERRIDE;
+
 };
 
 #endif // INCLUDED_VCL_INTROWIN_HXX
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 04ea155..15d4161 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -48,7 +48,8 @@ protected:
 public:
                         MessBox( vcl::Window* pParent, WinBits nStyle,
                                  const OUString& rTitle, const OUString& rMessage );
-                        virtual ~MessBox();
+    virtual             ~MessBox();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
 
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index c95b02d..017938b 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -35,8 +35,10 @@ public:
 class VCLOPENGL_DLLPUBLIC OpenGLWindow : public vcl::Window
 {
 public:
-    OpenGLWindow(vcl::Window* pParent);
-    virtual ~OpenGLWindow();
+                   OpenGLWindow(vcl::Window* pParent);
+    virtual        ~OpenGLWindow();
+    virtual void   dispose() SAL_OVERRIDE;
+
     OpenGLContext& getContext();
 
     void setRenderer(IRenderer* pRenderer);
diff --git a/include/vcl/syschild.hxx b/include/vcl/syschild.hxx
index 9a8c57d..6855e5d 100644
--- a/include/vcl/syschild.hxx
+++ b/include/vcl/syschild.hxx
@@ -42,6 +42,7 @@ public:
                             // create a SystemChildWindow using the given SystemWindowData
     explicit                SystemChildWindow( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow = true );
     virtual                 ~SystemChildWindow();
+    virtual void            dispose() SAL_OVERRIDE;
 
     const SystemEnvData*    GetSystemData() const;
 
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index f52d54d..301fc7e 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -178,7 +178,9 @@ protected:
 
     SAL_DLLPRIVATE void DoInitialLayout();
 public:
-                    virtual ~SystemWindow();
+    virtual         ~SystemWindow();
+    virtual void    dispose() SAL_OVERRIDE;
+
     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
 
diff --git a/include/vcl/wrkwin.hxx b/include/vcl/wrkwin.hxx
index 5b3a266..740e818 100644
--- a/include/vcl/wrkwin.hxx
+++ b/include/vcl/wrkwin.hxx
@@ -66,6 +66,7 @@ public:
     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
     virtual         ~WorkWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual bool    Close() SAL_OVERRIDE;
 
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index 119f24c..cb428cb 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -83,14 +83,14 @@ class ImplBorderWindow : public vcl::Window
 
 private:
     ImplBorderWindowView*   mpBorderView;
-    vcl::Window*                 mpMenuBarWindow;
+    vcl::Window*            mpMenuBarWindow;
     long                    mnMinWidth;
     long                    mnMinHeight;
     long                    mnMaxWidth;
     long                    mnMaxHeight;
     long                    mnRollHeight;
     long                    mnOrgMenuHeight;
-    sal_uInt16                  mnTitleType;
+    sal_uInt16              mnTitleType;
     WindowBorderStyle       mnBorderStyle;
     bool                    mbFloatWindow;
     bool                    mbSmallOutBorder;
@@ -122,7 +122,8 @@ public:
                                               sal_uInt16 nTypeStyle = 0 );
                             ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0,
                                               sal_uInt16 nTypeStyle = 0 );
-                            virtual ~ImplBorderWindow();
+    virtual                 ~ImplBorderWindow();
+    virtual void            dispose() SAL_OVERRIDE;
 
     virtual void            MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void            MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index e861af5..a67e72a 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 3c98801..1563a61 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 50c982e..032ca35 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -541,6 +541,8 @@ void Dialog::settingOptimalLayoutSize(VclBox *pBox)
 
 Dialog::~Dialog()
 {
+    dispose();
+
     delete mpDialogImpl;
     mpDialogImpl = NULL;
 }
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index b1534ec..4786fba 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -184,18 +184,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 fa311d3..4268f49 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 e89b511..8e39b9f 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 )
@@ -1060,15 +1071,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 8b2e14d..dcb68f3 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 3a4904c..ce33739 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -105,7 +105,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 5e1b343..3157be8 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 035d97f..802413c 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 d132469..df62869 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 f03ce5a..7d4b232 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 e71ca6d..5b297a2 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 d930c3d..9f54fc7 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 538c7c0..0c52fcd 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -106,9 +106,16 @@ void SystemWindow::loadUI(vcl::Window* pParent, const OString& rID, const OUStri
 
 SystemWindow::~SystemWindow()
 {
+    dispose();
+}
+
+void SystemWindow::dispose()
+{
     maLayoutIdle.Stop();
     delete mpImplData;
     mpImplData = NULL;
+
+    Window::dispose();
 }
 
 bool SystemWindow::Notify( NotifyEvent& rNEvt )
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 3351506..8eb0cf8 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 )


More information about the Libreoffice-commits mailing list