summaryrefslogtreecommitdiff
path: root/client/macrowindow.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-13 07:58:49 +0000
committerdeva <deva>2010-08-13 07:58:49 +0000
commitbc229dbfabdf6a59453605e7652f04a268605b3a (patch)
tree949c083efc8a06e1b55fa9440cc100d2b235215d /client/macrowindow.cc
parentd9338083192084613e5530b02710b796252d342b (diff)
Memory cleanup bug, fixed.
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r--client/macrowindow.cc45
1 files changed, 14 insertions, 31 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index efabbd1..38e466d 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -48,6 +48,7 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
: Collapser(), netcom(n)
{
mainwidget = NULL;
+ this->lua = new LUA(&mainwidget);
waschanged = false;
@@ -55,15 +56,11 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
setCollapsedWidget(new ResumeWidget(compact));
- this->lua = new LUA(&mainwidget);
update(xml_doc);
setCollapsed(collapsed);
active = true;
-
- connect(this, SIGNAL(doneCollapsing()), this, SLOT(collapsed()));
- connect(this, SIGNAL(doneExpanding()), this, SLOT(expanded()));
}
MacroWindow::~MacroWindow()
@@ -74,7 +71,6 @@ MacroWindow::~MacroWindow()
void MacroWindow::update(QDomNode &node)
{
- // clear();
initMacro(node);
if(mainwidget) setExpandedWidget(mainwidget->qwidget());
@@ -123,14 +119,8 @@ void MacroWindow::initMacro(QDomNode &node)
Window *window = new Window(xml_elem, this);
connect(window, SIGNAL(wasChanged()), this, SLOT(macroChanged()));
macrotitle = xml_elem.attribute("caption");
- //clear();
- /*
- if(mainwidget) {
- setExpandedWidget(NULL);
- delete mainwidget;
- mainwidget = NULL;
- }
- */
+
+ clear();
mainwidget = window;
QDomNodeList children = node.childNodes();
@@ -158,8 +148,8 @@ void MacroWindow::initMacro(QDomNode &node)
bool MacroWindow::doCommit()
{
if(mainwidget->valid()) {
- QDomDocument doc = netcom.send(mainwidget->widgetList(),
- templ, macro, version);
+ QVector< Widget* > wlist = mainwidget->widgetList();
+ QDomDocument doc = netcom.send(wlist, templ, macro, version);
QDomNodeList nl = doc.documentElement().childNodes();
QDomNode n = nl.at(0); // There can be only one! (Swush, flomp)
@@ -170,9 +160,11 @@ bool MacroWindow::doCommit()
return false;
}
- emit updateOnCommit();
+ qApp->processEvents();
- setCollapsed(true);
+ emit updateOnCommit();
+ // setCollapsed(true);
+ collapse();
return true;
} else {
@@ -239,8 +231,10 @@ void MacroWindow::expandWrapper()
QVector< Widget* > widgets = mainwidget->widgetList(true);
QVector< Widget* >::iterator i = widgets.begin();
while (i != widgets.end()) {
- Widget* w = *i;
- if(w->setKeyboardFocus()) break;
+ if(*i) {
+ Widget* w = *i;
+ if(w->setKeyboardFocus()) break;
+ }
i++;
}
@@ -309,7 +303,7 @@ void MacroWindow::setActive(bool active)
void MacroWindow::clear()
{
- if(mainwidget) delete mainwidget;
+ if(mainwidget) mainwidget->deleteLater();
mainwidget = NULL;
setExpandedWidget(NULL);
@@ -317,14 +311,3 @@ void MacroWindow::clear()
luaprograms.clear();
}
-void MacroWindow::collapsed()
-{
- printf("======== Collapsed ========\n");
-
- clear();
-}
-
-void MacroWindow::expanded()
-{
- printf("======== Expanded ========\n");
-}