summaryrefslogtreecommitdiff
path: root/client/widgets/widget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r--client/widgets/widget.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index af03843..2205beb 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -75,12 +75,6 @@ Widget::~Widget()
name().toStdString().c_str(),
type().toStdString().c_str());
- /* // This is done by Qt
- if(widget) {
- delete widget;
- widget = NULL;
- }
- */
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
if(*i) delete *i;
@@ -88,6 +82,12 @@ Widget::~Widget()
}
children.clear();
+
+ // This MUST be done after the deletion of the children Widget list.
+ if(widget) {
+ delete widget;
+ widget = NULL;
+ }
}
void Widget::addChildren(QDomNode &node)
@@ -121,7 +121,7 @@ bool Widget::valid()
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- if((*i)->valid() == false) return false;
+ if(*i && (*i)->valid() == false) return false;
i++;
}
@@ -194,8 +194,10 @@ Widget *Widget::findWidget(QString n, bool deep)
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- Widget *w = (*i)->findWidget(n, deep);
- if(w) return w;
+ if(*i) {
+ Widget *w = (*i)->findWidget(n, deep);
+ if(w) return w;
+ }
i++;
}
@@ -212,7 +214,7 @@ QVector< Widget* > Widget::widgetList(bool deep)
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- lst += (*i)->widgetList(deep);
+ if(*i) lst += (*i)->widgetList(deep);
i++;
}