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

Michael Meeks michael.meeks at collabora.com
Fri Jan 9 06:00:14 PST 2015


 include/vcl/button.hxx          |   10 ++++------
 include/vcl/combobox.hxx        |    7 ++-----
 include/vcl/spinfld.hxx         |    6 +-----
 include/vcl/vclmedit.hxx        |    6 ++++--
 vcl/source/control/button.cxx   |   33 ++++++++++++++++-----------------
 vcl/source/control/combobox.cxx |   13 ++++++++-----
 vcl/source/control/spinfld.cxx  |    1 +
 vcl/source/edit/vclmedit.cxx    |    8 ++++++++
 vcl/source/window/window2.cxx   |    8 ++++++--
 9 files changed, 50 insertions(+), 42 deletions(-)

New commits:
commit 760db0c95933208a834d86a284129c25ce1493e0
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Jan 9 13:38:59 2015 +0000

    vcl: add dispose implementations & destructor calls.
    
    Change-Id: Iefeaf81d4f7463440a6c5a8abb4d68aa85190698

diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index bbea9d7..548a68a 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -65,6 +65,7 @@ protected:
 
 public:
     virtual            ~Button();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        Click();
 
@@ -154,7 +155,6 @@ protected:
 public:
     explicit        PushButton( vcl::Window* pParent, WinBits nStyle = 0 );
     explicit        PushButton( vcl::Window* pParent, const ResId& );
-    virtual         ~PushButton();
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -342,6 +342,7 @@ public:
     explicit        RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
     explicit        RadioButton( vcl::Window* pParent, const ResId& );
     virtual         ~RadioButton();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -526,9 +527,8 @@ private:
     SAL_DLLPRIVATE          ImageButton & operator= ( const ImageButton & );
 
 public:
-                    ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
-                    ImageButton( vcl::Window* pParent, const ResId& rResId );
-                    virtual ~ImageButton();
+                 ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
+                 ImageButton( vcl::Window* pParent, const ResId& rResId );
 };
 
 class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
@@ -539,7 +539,6 @@ class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
 
 public:
     explicit        ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 );
-    virtual         ~ImageRadioButton();
 };
 
 class VCL_DLLPUBLIC TriStateBox : public CheckBox
@@ -550,7 +549,6 @@ class VCL_DLLPUBLIC TriStateBox : public CheckBox
 
 public:
     explicit        TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 );
-    virtual         ~TriStateBox();
 };
 
 class VCL_DLLPUBLIC DisclosureButton : public CheckBox
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 62f0326..d3a8be36 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -32,10 +32,6 @@ class ImplListBoxFloatingWindow;
 class ImplListBox;
 class ImplBtn;
 
-
-// - ComboBox -
-
-
 class VCL_DLLPUBLIC ComboBox : public Edit
 {
 private:
@@ -91,11 +87,12 @@ protected:
     bool            IsDropDownBox() const { return mpFloatWin ? true : false; }
 
     virtual void    FillLayoutData() const SAL_OVERRIDE;
-    virtual void    dispose() SAL_OVERRIDE;
+
 public:
     explicit        ComboBox( vcl::Window* pParent, WinBits nStyle = 0 );
     explicit        ComboBox( vcl::Window* pParent, const ResId& );
     virtual         ~ComboBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     virtual void    Resize() SAL_OVERRIDE;
diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx
index 493dcf8..b0474b1 100644
--- a/include/vcl/spinfld.hxx
+++ b/include/vcl/spinfld.hxx
@@ -26,9 +26,6 @@
 #include <vcl/timer.hxx>
 
 
-// - SpinField -
-
-
 class VCL_DLLPUBLIC SpinField : public Edit
 {
 protected:
@@ -69,12 +66,11 @@ protected:
     virtual void    FillLayoutData() const SAL_OVERRIDE;
     Rectangle *     ImplFindPartRect( const Point& rPt );
 
-    virtual void    dispose() SAL_OVERRIDE;
-
 public:
     explicit        SpinField( vcl::Window* pParent, WinBits nWinStyle = 0 );
     explicit        SpinField( vcl::Window* pParent, const ResId& );
     virtual         ~SpinField();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual bool    ShowDropDown( bool bShow );
 
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index b8b5933..950f2ce 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -57,8 +57,10 @@ protected:
     ScrollBar*      GetVScrollBar() const;
 
 public:
-    VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
-    virtual ~VclMultiLineEdit();
+                    VclMultiLineEdit( vcl::Window* pParent,
+                                      WinBits nWinStyle = WB_LEFT | WB_BORDER );
+    virtual         ~VclMultiLineEdit();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            SelectionChanged();
     void            CaretChanged();
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index f8f3da8..b04b1bd 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -101,7 +101,15 @@ Button::Button( WindowType nType ) :
 
 Button::~Button()
 {
+    dispose();
+}
+
+void Button::dispose()
+{
     delete mpButtonData;
+    mpButtonData = NULL;
+
+    Control::dispose();
 }
 
 void Button::SetCommandHandler(const OUString& aCommand)
@@ -1210,10 +1218,6 @@ PushButton::PushButton( vcl::Window* pParent, const ResId& rResId ) :
         Show();
 }
 
-PushButton::~PushButton()
-{
-}
-
 void PushButton::MouseButtonDown( const MouseEvent& rMEvt )
 {
     if ( rMEvt.IsLeft() &&
@@ -2343,11 +2347,18 @@ void RadioButton::ImplLoadRes( const ResId& rResId )
 
 RadioButton::~RadioButton()
 {
+    dispose();
+}
+
+void RadioButton::dispose()
+{
     if (m_xGroup)
     {
         m_xGroup->erase(std::remove(m_xGroup->begin(), m_xGroup->end(), this),
-            m_xGroup->end());
+                        m_xGroup->end());
+        m_xGroup.reset();
     }
+    Button::dispose();
 }
 
 void RadioButton::MouseButtonDown( const MouseEvent& rMEvt )
@@ -3791,10 +3802,6 @@ ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) :
     ImplInitStyle();
 }
 
-ImageButton::~ImageButton()
-{
-}
-
 void ImageButton::ImplInitStyle()
 {
     WinBits nStyle = GetStyle();
@@ -3813,20 +3820,12 @@ ImageRadioButton::ImageRadioButton( vcl::Window* pParent, WinBits nStyle ) :
 {
 }
 
-ImageRadioButton::~ImageRadioButton()
-{
-}
-
 TriStateBox::TriStateBox( vcl::Window* pParent, WinBits nStyle ) :
     CheckBox( pParent, nStyle )
 {
     EnableTriState( true );
 }
 
-TriStateBox::~TriStateBox()
-{
-}
-
 DisclosureButton::DisclosureButton( vcl::Window* pParent, WinBits nStyle ) :
     CheckBox( pParent, nStyle )
 {
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 39a3164..88a341e 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -68,19 +68,22 @@ ComboBox::ComboBox( vcl::Window* pParent, const ResId& rResId ) :
 
 ComboBox::~ComboBox()
 {
-    SetSubEdit(VclPtr<Edit>());
+    dispose();
+}
+
+void ComboBox::dispose()
+{
+    mpSubEdit.disposeAndClear();
 
     ImplListBox *pImplLB = mpImplLB;
     mpImplLB = NULL;
     delete pImplLB;
 
     delete mpFloatWin;
+    mpFloatWin = NULL;
     delete mpBtn;
-}
+    mpBtn = NULL;
 
-void ComboBox::dispose()
-{
-    mpSubEdit.disposeAndClear();
     Edit::dispose();
 }
 
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 23573b1..a7172ec 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -365,6 +365,7 @@ SpinField::~SpinField()
 void SpinField::dispose()
 {
     mpEdit.disposeAndClear();
+
     Edit::dispose();
 }
 
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index c160340..cf76456 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -938,11 +938,19 @@ VclMultiLineEdit::VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle )
 
 VclMultiLineEdit::~VclMultiLineEdit()
 {
+    dispose();
+}
+
+void VclMultiLineEdit::dispose()
+{
     {
         boost::scoped_ptr< ImpVclMEdit > pDelete( pImpVclMEdit );
         pImpVclMEdit = NULL;
     }
     delete pUpdateDataTimer;
+    pUpdateDataTimer = NULL;
+
+    Edit::dispose();
 }
 
 WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle )
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 1815cdd..f2a9b1e 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1091,12 +1091,16 @@ WinBits Window::GetExtendedStyle() const
 
 void Window::SetType( WindowType nType )
 {
-    mpWindowImpl->mnType = nType;
+    if (mpWindowImpl)
+        mpWindowImpl->mnType = nType;
 }
 
 WindowType Window::GetType() const
 {
-    return mpWindowImpl->mnType;
+    if (mpWindowImpl)
+        return mpWindowImpl->mnType;
+    else
+        return WINDOW_PARENT;
 }
 
 Dialog* Window::GetParentDialog() const


More information about the Libreoffice-commits mailing list