From 16fc17f9eb7d5bef0f545feefdd12dd54c20b89b Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Mon, 8 Aug 2011 09:45:52 +1000 Subject: [PATCH] don't create QApplication if there is already one there Change-Id: Iaf9ebf6855992962abfb3452dc398149af15bbbc Reviewed-on: http://codereview.qt.nokia.com/2711 Reviewed-by: Charles Yin --- src/qmltest/quicktest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 3f0c532..5b700b3 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -110,7 +110,10 @@ static inline QString stripQuotes(const QString &s) int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport_create createViewport, const char *sourceDir) { - QApplication app(argc, argv); + QApplication* app = 0; + if (!QCoreApplication::instance()) { + app = new QApplication(argc, argv); + } // Look for QML-specific command-line options. // -import dir Specify an import directory. @@ -287,6 +290,7 @@ int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport // Flush the current logging stream. QuickTestResult::setProgramName(0); + delete app; // Return the number of failures as the exit code. return QuickTestResult::exitCode(); } -- 2.7.4