summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-08-15 13:19:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:35 +0100
commita8875d1373f57370026e270fb51e1205e9d1edbf (patch)
treec6eb4c253fa639f9bf7d56b0c5746101c38dedfe /vcl
parent0296b3a6948bec92687ab7960bd7ae4c8454e702 (diff)
get order of destruction right to keep vcl happy
Change-Id: I7db392bdc7f3be02d47cde783f029cc98308b17d
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/builder.hxx10
-rw-r--r--vcl/inc/vcl/dialog.hxx1
-rw-r--r--vcl/source/window/dialog.cxx12
3 files changed, 17 insertions, 6 deletions
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index f5a100604eb3..7b9823feff1d 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -165,7 +165,14 @@ private:
//allows retro fitting existing dialogs/tabpages that load a resource
//to load a .ui file instead
-
+//
+//vcl requires the Window Children of a Parent Window to be destroyed before
+//the Parent Window. VclBuilderContainer owns the VclBuilder which owns the
+//Children Window. So the VclBuilderContainer dtor must be called before
+//the Parent Window dtor.
+//
+//i.e. class Dialog : public SystemWindow, public VclBuilderContainer
+//not class Dialog : public VclBuilderContainer, public SystemWindow
class ResId;
class VCL_DLLPUBLIC VclBuilderContainer
@@ -174,6 +181,7 @@ protected:
VclBuilder *m_pUIBuilder;
public:
VclBuilderContainer();
+ virtual ~VclBuilderContainer();
static VclBuilder* overrideResourceWithUIXML(Window *pWindow, const ResId& rResId);
static bool replace_buildable(Window *pParent, sal_Int32 nID, Window &rReplacement);
};
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx
index a162522123ce..bc5e712e40ee 100644
--- a/vcl/inc/vcl/dialog.hxx
+++ b/vcl/inc/vcl/dialog.hxx
@@ -43,7 +43,6 @@
// - Dialog -
// ----------
struct DialogImpl;
-class VclBuilder;
class VclContainer;
class VCL_DLLPUBLIC Dialog
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 76b3dd2fc885..12d7feab0517 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -581,6 +581,7 @@ WinBits Dialog::init(Window *pParent, const ResId& rResId)
Dialog::~Dialog()
{
+ maLayoutTimer.Stop();
delete mpDialogImpl;
mpDialogImpl = NULL;
}
@@ -1163,8 +1164,8 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal
bool Dialog::isLayoutEnabled() const
{
- //Single child is a container => we're layout enabled
- const Window *pChild = GetWindow(WINDOW_FIRSTCHILD);
+ //pre dtor called, and single child is a container => we're layout enabled
+ const Window *pChild = mpDialogImpl ? GetWindow(WINDOW_FIRSTCHILD) : NULL;
return pChild && pChild->GetType() == WINDOW_CONTAINER && !pChild->GetWindow(WINDOW_NEXT);
}
@@ -1198,8 +1199,6 @@ void Dialog::setPosSizeOnContainee(Size aSize, VclContainer &rBox)
IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG )
{
- fprintf(stderr, "ImplHandleLayoutTimerHdl\n");
-
if (!isLayoutEnabled())
{
fprintf(stderr, "Dialog has become non-layout because extra children have been added directly to it!\n");
@@ -1237,6 +1236,11 @@ VclBuilderContainer::VclBuilderContainer()
{
}
+VclBuilderContainer::~VclBuilderContainer()
+{
+ delete m_pUIBuilder;
+}
+
bool VclBuilderContainer::replace_buildable(Window *pParent, sal_Int32 nID, Window &rReplacement)
{
if (!pParent)