From 802fe64d729a48d6731d2ec82b43e0cc1e8edc32 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 22 May 2013 18:08:25 +0200 Subject: fix crash in scriptengine autotest - destructor deletes components, so there was a double deletion Change-Id: I5c4f14bb3b964297be542821d10a7ebb27925af5 Reviewed-by: Karsten Heimrich --- tests/auto/installer/scriptengine/tst_scriptengine.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') 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."); } -- cgit v1.2.3