diff options
author | dac <qt-info@nokia.com> | 2010-08-04 12:36:17 +1000 |
---|---|---|
committer | dac <qt-info@nokia.com> | 2010-08-04 12:36:17 +1000 |
commit | 66fcf566f68dcb5dfe058200543448fbc7636cbe (patch) | |
tree | 792f80bf51acb478e27f3e4fb19ca25e0e9688cf | |
parent | acce6f416c9eea7a53f62529cedd871f63e5c290 (diff) |
Clear metaObject data before rebuilding, to prevent crash in Creator
when running more than one test script.
-rw-r--r-- | interpreter/qscriptsystemtest.cpp | 6 | ||||
-rw-r--r-- | interpreter/qtscript_bindings.cpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp index ffa8a5c..bff6dff 100644 --- a/interpreter/qscriptsystemtest.cpp +++ b/interpreter/qscriptsystemtest.cpp @@ -256,7 +256,7 @@ void QScriptSystemTest::initEngine(bool createNewEngine) return; } } - + m_engine = new QScriptEngine(); m_agent = new QtUiTestEngineAgent(m_engine, this); @@ -534,6 +534,7 @@ int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶mete const QStringList &environment) { m_env = environment; + bool createNewEngine = filename == fname; filename = fname; QFile file(filename); @@ -547,8 +548,7 @@ int QScriptSystemTest::runTest(const QString &fname, const QStringList ¶mete ScriptPreprocessor().preprocess(script); - initEngine(fname != filename); -// m_engine->setGlobalObject(QScriptValue()); + initEngine(createNewEngine); // Allow shebangs without giving syntax errors. if (script.startsWith("#!")) script.prepend("//"); diff --git a/interpreter/qtscript_bindings.cpp b/interpreter/qtscript_bindings.cpp index 7692290..dc66659 100644 --- a/interpreter/qtscript_bindings.cpp +++ b/interpreter/qtscript_bindings.cpp @@ -268,6 +268,7 @@ QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptDat } QVector<uint> *data = qt_meta_data_QtScriptTest(); + data->clear(); // content: *data << 1 // revision << 0 // classname @@ -280,6 +281,7 @@ QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptDat QString testcaseName = QFileInfo(m_testFilePath).baseName(); QVector<char> *stringdata = qt_meta_stringdata_QtScriptTest(); + stringdata->clear(); appendCString(stringdata, testcaseName.toLocal8Bit() ); int namelen = stringdata->size(); appendCString(stringdata, ""); |