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
commitbec41947b691f8a993a3048c2c58e8e1fa36d276 (patch)
tree5dd52ef6715beef259edab70f3cfa1c37233ae35
parentFix another memory leak (better methods possibly available, but this will suf... (diff)
downloadproject2-bec41947b691f8a993a3048c2c58e8e1fa36d276.tar.bz2
project2-bec41947b691f8a993a3048c2c58e8e1fa36d276.tar.xz
project2-bec41947b691f8a993a3048c2c58e8e1fa36d276.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;
}