summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-01-07 17:05:30 +0000
committerrandomdan <randomdan@localhost>2012-01-07 17:05:30 +0000
commit8d49d69e5841267dd168630eb9f416c63b69b852 (patch)
tree5dd52ef6715beef259edab70f3cfa1c37233ae35
parentFix another memory leak (better methods possibly available, but this will suf... (diff)
downloadproject2-8d49d69e5841267dd168630eb9f416c63b69b852.tar.bz2
project2-8d49d69e5841267dd168630eb9f416c63b69b852.tar.xz
project2-8d49d69e5841267dd168630eb9f416c63b69b852.zip
Initialise flags properly and only use script when there is one
-rw-r--r--project2/common/commonObjects.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/project2/common/commonObjects.cpp b/project2/common/commonObjects.cpp
index 0e58cc8..f27696f 100644
--- a/project2/common/commonObjects.cpp
+++ b/project2/common/commonObjects.cpp
@@ -4,19 +4,23 @@
#include "appEngine.h"
#include "scriptLoader.h"
-CommonObjects::CommonObjects()
+CommonObjects::CommonObjects() :
+ scriptLoaded(true)
{
}
CommonObjects::CommonObjects(ScriptNodePtr s) :
- script(s->script)
+ script(s->script),
+ scriptLoaded(false)
{
s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&rowSets));
}
CommonObjects::~CommonObjects()
{
- script->loader.discardLoadTargets();
+ if (script) {
+ script->loader.discardLoadTargets();
+ }
}
RowSetPtr
@@ -37,7 +41,7 @@ CommonObjects::loadDataSource(const std::string & name) const
void
CommonObjects::loadScriptComponents() const
{
- if (!scriptLoaded) {
+ if (!scriptLoaded && script) {
script->load(this, true);
scriptLoaded = true;
}