summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-08-05 07:38:02 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-08-05 07:38:02 +0000
commit2ea1a34f981fec971057c4df23791e3cf70a1b0c (patch)
treeef3ea79551dfe23ed96d8cb7ed87557fd393afed /utils/themeeditor
parentbfc20975b068d707ad46a5f02d8561852e41f311 (diff)
downloadrockbox-2ea1a34f981fec971057c4df23791e3cf70a1b0c.tar.gz
rockbox-2ea1a34f981fec971057c4df23791e3cf70a1b0c.tar.bz2
rockbox-2ea1a34f981fec971057c4df23791e3cf70a1b0c.zip
Theme Editor: Stopped bug that caused segfault if SBS element was moved from within a WPS preview
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27712 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor')
-rw-r--r--utils/themeeditor/models/parsetreemodel.cpp17
-rw-r--r--utils/themeeditor/models/parsetreemodel.h1
2 files changed, 12 insertions, 6 deletions
diff --git a/utils/themeeditor/models/parsetreemodel.cpp b/utils/themeeditor/models/parsetreemodel.cpp
index f83443a5e4..e30d0be09d 100644
--- a/utils/themeeditor/models/parsetreemodel.cpp
+++ b/utils/themeeditor/models/parsetreemodel.cpp
@@ -35,7 +35,7 @@
#include <iostream>
ParseTreeModel::ParseTreeModel(const char* document, QObject* parent):
- QAbstractItemModel(parent)
+ QAbstractItemModel(parent), sbsModel(0)
{
this->tree = skin_parse(document);
@@ -54,6 +54,8 @@ ParseTreeModel::~ParseTreeModel()
delete root;
if(tree)
skin_free_tree(tree);
+ if(sbsModel)
+ sbsModel->deleteLater();
}
QString ParseTreeModel::genCode()
@@ -324,19 +326,22 @@ QGraphicsScene* ParseTreeModel::render(ProjectModel* project,
{
QFile sbs(sbsFile);
sbs.open(QFile::ReadOnly | QFile::Text);
- ParseTreeModel sbsModel(QString(sbs.readAll()).toAscii());
- if(sbsModel.root != 0)
+ if(sbsModel)
+ sbsModel->deleteLater();
+ sbsModel = new ParseTreeModel(QString(sbs.readAll()).toAscii());
+
+ if(sbsModel->root != 0)
{
- RBRenderInfo sbsInfo(&sbsModel, project, doc, &settings, device,
+ RBRenderInfo sbsInfo(sbsModel, project, doc, &settings, device,
sbsScreen);
sbsScreen = new RBScreen(sbsInfo, remote);
scene->addItem(sbsScreen);
- sbsInfo = RBRenderInfo(&sbsModel, project, doc, &settings,
+ sbsInfo = RBRenderInfo(sbsModel, project, doc, &settings,
device, sbsScreen);
- sbsModel.root->render(sbsInfo);
+ sbsModel->root->render(sbsInfo);
}
}
diff --git a/utils/themeeditor/models/parsetreemodel.h b/utils/themeeditor/models/parsetreemodel.h
index 3c20a8ed3a..2c762f3645 100644
--- a/utils/themeeditor/models/parsetreemodel.h
+++ b/utils/themeeditor/models/parsetreemodel.h
@@ -81,6 +81,7 @@ public:
private:
ParseTreeNode* root;
+ ParseTreeModel* sbsModel;
struct skin_element* tree;
QGraphicsScene* scene;
};