aboutsummaryrefslogtreecommitdiff
path: root/dw/layout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dw/layout.cc')
-rw-r--r--dw/layout.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index e33da4d1..d2097859 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -219,14 +219,19 @@ Layout::Layout (Platform *platform)
Layout::~Layout ()
{
+ widgetAtPoint = NULL;
+
if (scrollIdleId != -1)
platform->removeIdle (scrollIdleId);
if (resizeIdleId != -1)
platform->removeIdle (resizeIdleId);
if (bgColor)
bgColor->unref ();
- if (topLevel)
- delete topLevel;
+ if (topLevel) {
+ Widget *w = topLevel;
+ topLevel = NULL;
+ delete w;
+ }
delete platform;
delete view;
delete anchorsTable;
@@ -278,9 +283,12 @@ void Layout::removeWidget ()
void Layout::setWidget (Widget *widget)
{
- if (topLevel)
- delete topLevel;
widgetAtPoint = NULL;
+ if (topLevel) {
+ Widget *w = topLevel;
+ topLevel = NULL;
+ delete w;
+ }
textZone->zoneFree ();
addWidget (widget);