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

vcl: more rtl::Reference cleanup

Change-Id: Idef6b4259d784120a06d2a6c51b77029566da59f
üst b72c6feb
...@@ -62,6 +62,7 @@ public: ...@@ -62,6 +62,7 @@ public:
explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 ); explicit FixedText( vcl::Window* pParent, WinBits nStyle = 0 );
explicit FixedText( vcl::Window* pParent, const ResId& rResId ); explicit FixedText( vcl::Window* pParent, const ResId& rResId );
virtual ~FixedText(); virtual ~FixedText();
virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
......
...@@ -742,6 +742,7 @@ public: ...@@ -742,6 +742,7 @@ public:
void set_primary_text(const OUString &rPrimaryString); void set_primary_text(const OUString &rPrimaryString);
void set_secondary_text(const OUString &rSecondaryString); void set_secondary_text(const OUString &rSecondaryString);
virtual ~MessageDialog(); virtual ~MessageDialog();
virtual void dispose() SAL_OVERRIDE;
static void SetMessagesWidths(vcl::Window *pParent, VclMultiLineEdit *pPrimaryMessage, static void SetMessagesWidths(vcl::Window *pParent, VclMultiLineEdit *pPrimaryMessage,
VclMultiLineEdit *pSecondaryMessage); VclMultiLineEdit *pSecondaryMessage);
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,vcl_lifecycle))
$(eval $(call gb_CppunitTest_set_include,vcl_lifecycle,\
$$(INCLUDE) \
-I$(SRCDIR)/vcl/inc \
))
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_lifecycle, \
vcl/qa/cppunit/lifecycle \
))
$(eval $(call gb_CppunitTest_use_externals,vcl_lifecycle,boost_headers))
$(eval $(call gb_CppunitTest_use_libraries,vcl_lifecycle, \
comphelper \
cppu \
cppuhelper \
sal \
svt \
test \
tl \
unotest \
vcl \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_use_api,vcl_lifecycle,\
udkapi \
offapi \
))
$(eval $(call gb_CppunitTest_use_ure,vcl_lifecycle))
$(eval $(call gb_CppunitTest_use_vcl,vcl_lifecycle))
$(eval $(call gb_CppunitTest_use_components,vcl_lifecycle,\
configmgr/source/configmgr \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
))
$(eval $(call gb_CppunitTest_use_configuration,vcl_lifecycle))
# vim: set noet sw=4 ts=4:
...@@ -103,6 +103,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\ ...@@ -103,6 +103,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
CppunitTest_vcl_fontcharmap \ CppunitTest_vcl_fontcharmap \
CppunitTest_vcl_complextext \ CppunitTest_vcl_complextext \
CppunitTest_vcl_filters_test \ CppunitTest_vcl_filters_test \
CppunitTest_vcl_lifecycle \
CppunitTest_vcl_outdev \ CppunitTest_vcl_outdev \
CppunitTest_vcl_app_test \ CppunitTest_vcl_app_test \
CppunitTest_vcl_wmf_test \ CppunitTest_vcl_wmf_test \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <unotest/filters-test.hxx>
#include <test/bootstrapfixture.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/button.hxx>
class LifecycleTest : public test::BootstrapFixture
{
void testWidgets(vcl::Window *pParent);
public:
LifecycleTest() : BootstrapFixture(true, false) {}
void testIsolatedWidgets();
void testParentedWidgets();
CPPUNIT_TEST_SUITE(LifecycleTest);
CPPUNIT_TEST(testIsolatedWidgets);
CPPUNIT_TEST(testParentedWidgets);
CPPUNIT_TEST_SUITE_END();
};
void LifecycleTest::testWidgets(vcl::Window *pParent)
{
{ PushButtonPtr aPtr(new PushButton(pParent)); }
{ OKButtonPtr aPtr(new OKButton(pParent)); }
{ CancelButtonPtr aPtr(new CancelButton(pParent)); }
{ HelpButtonPtr aPtr(new HelpButton(pParent)); }
// Some widgets really insist on adoption.
if (pParent)
{
{ CheckBoxPtr aPtr(new CheckBox(pParent)); }
}
// { RadioButtonPtr aPtr(new RadioButton(pParent)); }
}
void LifecycleTest::testIsolatedWidgets()
{
testWidgets(NULL);
}
void LifecycleTest::testParentedWidgets()
{
VclReference<WorkWindow> xWin(new WorkWindow((vcl::Window *)NULL,
WB_APP|WB_STDWORK));
CPPUNIT_ASSERT(xWin.get() != NULL);
testWidgets(xWin.get());
}
CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -459,8 +459,14 @@ void FixedText::set_mnemonic_widget(vcl::Window *pWindow) ...@@ -459,8 +459,14 @@ void FixedText::set_mnemonic_widget(vcl::Window *pWindow)
} }
FixedText::~FixedText() FixedText::~FixedText()
{
dispose();
}
void FixedText::dispose()
{ {
set_mnemonic_widget(NULL); set_mnemonic_widget(NULL);
Control::dispose();
} }
SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle) SelectableFixedText::SelectableFixedText(vcl::Window* pParent, WinBits nStyle)
......
...@@ -1992,16 +1992,36 @@ MessageDialog::MessageDialog(vcl::Window* pParent, const OString& rID, const OUS ...@@ -1992,16 +1992,36 @@ MessageDialog::MessageDialog(vcl::Window* pParent, const OString& rID, const OUS
{ {
} }
MessageDialog::~MessageDialog() void MessageDialog::dispose()
{ {
for (size_t i = 0; i < m_aOwnedButtons.size(); ++i) for (size_t i = 0; i < m_aOwnedButtons.size(); ++i)
delete m_aOwnedButtons[i]; delete m_aOwnedButtons[i];
m_aOwnedButtons.clear();
delete m_pSecondaryMessage; delete m_pSecondaryMessage;
m_pSecondaryMessage = NULL;
delete m_pPrimaryMessage; delete m_pPrimaryMessage;
m_pSecondaryMessage = NULL;
delete m_pImage; delete m_pImage;
m_pImage = NULL;
delete m_pGrid; delete m_pGrid;
m_pGrid = NULL;
delete m_pOwnedActionArea; delete m_pOwnedActionArea;
m_pOwnedActionArea = NULL;
delete m_pOwnedContentArea; delete m_pOwnedContentArea;
m_pOwnedContentArea = NULL;
Dialog::dispose();
}
MessageDialog::~MessageDialog()
{
dispose();
} }
void MessageDialog::response(short nResponseId) void MessageDialog::response(short nResponseId)
......
...@@ -551,6 +551,8 @@ void Window::dispose() ...@@ -551,6 +551,8 @@ void Window::dispose()
vcl::Window* pSysWin = pSVData->maWinData.mpFirstFrame; vcl::Window* pSysWin = pSVData->maWinData.mpFirstFrame;
while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this ) while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this )
pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame; pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
assert (mpWindowImpl->mpFrameData->mpNextFrame != pSysWin);
pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame; pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame;
} }
mpWindowImpl->mpFrame->SetCallback( NULL, NULL ); mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
...@@ -565,7 +567,7 @@ void Window::dispose() ...@@ -565,7 +567,7 @@ void Window::dispose()
Window::~Window() Window::~Window()
{ {
vcl::LazyDeletor<vcl::Window>::Undelete( this ); vcl::LazyDeletor<vcl::Window>::Undelete( this );
dispose ();
DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" ); DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
} }
...@@ -990,6 +992,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p ...@@ -990,6 +992,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
mpWindowImpl->mpOverlapWindow = this; mpWindowImpl->mpOverlapWindow = this;
// set frame data // set frame data
assert (pSVData->maWinData.mpFirstFrame != this);
mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame; mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
pSVData->maWinData.mpFirstFrame = this; pSVData->maWinData.mpFirstFrame = this;
mpWindowImpl->mpFrameData->mpFirstOverlap = NULL; mpWindowImpl->mpFrameData->mpFirstOverlap = NULL;
......
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