diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2013-05-22 18:08:25 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2013-05-22 18:14:00 +0200 |
commit | 802fe64d729a48d6731d2ec82b43e0cc1e8edc32 (patch) | |
tree | 4ff6e3b5a00e84fd61e1bac87d160e8a3e5832c1 /tests/auto/installer/scriptengine | |
parent | 6c83ad963776f282d2fde11f1ac21d9f3ef4aef0 (diff) |
fix crash in scriptengine autotest
- destructor deletes components, so there was a double deletion
Change-Id: I5c4f14bb3b964297be542821d10a7ebb27925af5
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'tests/auto/installer/scriptengine')
-rw-r--r-- | tests/auto/installer/scriptengine/tst_scriptengine.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp index 23fcd99b7..c6332ff7e 100644 --- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -136,10 +136,12 @@ private slots: void loadBrokenComponentScript() { - Component testComponent(&m_core); - testComponent.setValue(scName, "broken.component"); + Component *testComponent = new Component(&m_core); + testComponent->setValue(scName, "broken.component"); - m_core.appendRootComponent(&testComponent); + // now m_core becomes the owner of testComponent + // so it will delete it then at the destuctor + m_core.appendRootComponent(testComponent); const QString debugMesssage( "create Error-Exception: \"Exception while loading the component script: ':///data/component2.qs\n\n" @@ -156,7 +158,7 @@ private slots: // ignore Output from script setExpectedScriptOutput("script function: Component"); setExpectedScriptOutput(qPrintable(debugMesssage)); - testComponent.loadComponentScript(":///data/component2.qs"); + testComponent->loadComponentScript(":///data/component2.qs"); } catch (const Error &error) { QVERIFY2(debugMesssage.contains(error.message()), "There was some unexpected error."); } |