From d78717e7294f4b181c2f84f495bdda777069f6c2 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 9 Sep 2009 13:16:17 +0300 Subject: Fix for E32User-Cbase 69 panic, when runnign QtNetwork autotests Reviewed-by: Janne Koskinen --- tests/auto/network-settings.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 1281d74..3a5bed7 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -46,6 +46,7 @@ #ifdef Q_OS_SYMBIAN +#include #include #include #include @@ -333,13 +334,21 @@ QByteArray QtNetworkSettings::imapExpectedReplySsl; class QtNetworkSettingsInitializerCode { public: QtNetworkSettingsInitializerCode() { - QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName()); - if (testServerResult.error() != QHostInfo::NoError) { - qWarning() << "Could not lookup" << QtNetworkSettings::serverName(); - qWarning() << "Please configure the test environment!"; - qWarning() << "See /etc/hosts or network-settings.h"; - qFatal("Exiting"); - } + // We have a non-trivial constructor in global static. + // The QtNetworkSettings::serverName() uses native API which assumes + // Cleanup-stack to exist. That's why we create it here and install + // top level TRAP harness. + CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New()); + TRAPD(err, + QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName()); + if (testServerResult.error() != QHostInfo::NoError) { + qWarning() << "Could not lookup" << QtNetworkSettings::serverName(); + qWarning() << "Please configure the test environment!"; + qWarning() << "See /etc/hosts or network-settings.h"; + qFatal("Exiting"); + } + ) + delete cleanupStack; } }; QtNetworkSettingsInitializerCode qtNetworkSettingsInitializer; -- cgit v0.12