[Libreoffice-commits] core.git: Branch 'feature/vclref' - 4 commits - dbaccess/source sfx2/source svtools/source svx/source vcl/qa
Michael Meeks
michael.meeks at collabora.com
Thu Feb 26 08:35:28 PST 2015
dbaccess/source/ui/app/AppView.cxx | 15 +++++++++++----
dbaccess/source/ui/browser/dataview.cxx | 1 +
sfx2/source/sidebar/Deck.cxx | 5 +++++
sfx2/source/sidebar/TabBar.cxx | 2 ++
svtools/source/contnr/imivctl1.cxx | 1 -
svtools/source/contnr/ivctrl.cxx | 3 ++-
svtools/source/control/ruler.cxx | 5 +++++
svx/source/dialog/svxruler.cxx | 11 ++++++++---
vcl/qa/cppunit/lifecycle.cxx | 23 +++++++++++++++++++++++
9 files changed, 57 insertions(+), 9 deletions(-)
New commits:
commit 2e263283ba6a3a6446fefbfb38aa7205803b7c6b
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Feb 26 16:36:38 2015 +0000
more double dispose protection.
Change-Id: I61ecf1561393959bc9a3647d515c4c9ce5119752
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index 06896f5..6485aac 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -214,10 +214,17 @@ OApplicationView::~OApplicationView()
void OApplicationView::dispose()
{
- stopComponentListening(m_xObject);
- m_pWin->Hide();
- boost::scoped_ptr<vcl::Window> aTemp(m_pWin);
- m_pWin = NULL;
+ if (m_xObject.is())
+ {
+ stopComponentListening(m_xObject);
+ m_xObject.clear();
+ }
+ if (m_pWin)
+ {
+ m_pWin->Hide();
+ boost::scoped_ptr<vcl::Window> aTemp(m_pWin);
+ m_pWin = NULL;
+ }
ODataView::dispose();
}
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 979db11..3f15879 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -86,6 +86,7 @@ namespace dbaui
{
m_rController.release();
m_aSeparator.disposeAndClear();
+ m_pAccel.reset();
vcl::Window::dispose();
}
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 27a442e..9107deb 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -172,7 +172,6 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl()
aVerSBar.disposeAndClear();
aHorSBar.disposeAndClear();
aScrBarBox.disposeAndClear();
-
}
void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor )
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 4c08065..90efec0 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -246,7 +246,8 @@ void SvtIconChoiceCtrl::GetFocus()
void SvtIconChoiceCtrl::LoseFocus()
{
- _pImp->LoseFocus();
+ if (_pImp)
+ _pImp->LoseFocus();
Control::LoseFocus();
}
commit 3514b07b470389d4403bf473ac870f7c87d3eb65
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Feb 26 16:09:18 2015 +0000
vclref: protect vs. double disposes.
Change-Id: I86fe17ad9afba7ee1e87aaa732bebee1746c140f
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 3c0b0b9..6c1f7ef 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -303,9 +303,14 @@ void Ruler::dispose()
if ( mnUpdateEvtId )
Application::RemoveUserEvent( mnUpdateEvtId );
delete mpSaveData;
+ mpSaveData = NULL;
delete mpDragData;
+ mpDragData = NULL;
if( pAccContext )
+ {
pAccContext->release();
+ pAccContext = NULL;
+ }
Window::dispose();
}
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 287c643..a0c9038 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -328,11 +328,16 @@ void SvxRuler::dispose()
pBindings->EnterRegistrations();
- for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
- delete pCtrlItem[i];
- delete[] pCtrlItem;
+ if (pCtrlItem)
+ {
+ for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
+ delete pCtrlItem[i];
+ delete[] pCtrlItem;
+ pCtrlItem = NULL;
+ }
pBindings->LeaveRegistrations();
+
Ruler::dispose();
}
commit b837817239c86d3a5fcaca73e9cadc8f40b17c56
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Feb 26 16:09:06 2015 +0000
vcl: new lifecycle test.
Change-Id: I05500c136839877db5c4a215b15e24a8444d3c16
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index dc6bbf2..2a46022 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -27,12 +27,14 @@ public:
void testMultiDispose();
void testIsolatedWidgets();
void testParentedWidgets();
+ void testChildDispose();
CPPUNIT_TEST_SUITE(LifecycleTest);
CPPUNIT_TEST(testCast);
CPPUNIT_TEST(testMultiDispose);
CPPUNIT_TEST(testIsolatedWidgets);
CPPUNIT_TEST(testParentedWidgets);
+ CPPUNIT_TEST(testChildDispose);
CPPUNIT_TEST_SUITE_END();
};
@@ -94,6 +96,27 @@ void LifecycleTest::testParentedWidgets()
testWidgets(xWin);
}
+class DisposableChild : public vcl::Window
+{
+public:
+ DisposableChild(vcl::Window *pParent) : vcl::Window(pParent) {}
+ virtual ~DisposableChild()
+ {
+ dispose();
+ }
+};
+
+void LifecycleTest::testChildDispose()
+{
+ VclPtr<WorkWindow> xWin(new WorkWindow((vcl::Window *)NULL,
+ WB_APP|WB_STDWORK));
+ CPPUNIT_ASSERT(xWin.get() != NULL);
+ VclPtr<DisposableChild> xChild(new DisposableChild(xWin.get()));
+ xWin->Show();
+ xChild->dispose();
+ xWin->dispose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 6335445dcacb5642516ee6677847d1c2b99e96d8
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Feb 26 16:07:39 2015 +0000
vcl lifecycle: delete children in dispose.
We can no longer rely on smart ptr members getting destroyed and
tearing down children before parents in the new order.
Change-Id: Ib22df93443d98f53543d3a8ac322e965623148d0
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 11f8895..3b7980e 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -89,6 +89,9 @@ void Deck::dispose()
// We have to explicitly trigger the destruction of panels.
// Otherwise that is done by one of our base class destructors
// without updating maPanels.
+ for (size_t i = 0; i < maPanels.size(); i++)
+ maPanels[i]->dispose();
+
maPanels.clear();
vcl::Window::dispose();
}
@@ -117,6 +120,8 @@ void Deck::Dispose (void)
mpTitleBar.reset();
mpFiller.reset();
mpVerticalScrollBar.reset();
+ mpScrollContainer.reset();
+ mpScrollClipWindow.reset();
}
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 45d1093..5f71b14 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -76,6 +76,8 @@ TabBar::~TabBar()
void TabBar::dispose()
{
+ maItems.clear();
+ mpMenuButton.reset();
vcl::Window::dispose();
}
More information about the Libreoffice-commits
mailing list