src/hbcore/gui/hbsplashscreen.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
--- a/src/hbcore/gui/hbsplashscreen.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/gui/hbsplashscreen.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -131,11 +131,13 @@
 #endif
 }
 
-// Called when QApplication is constructed and the splash was launched
-// before that. This gives a chance for the splash screen to do
+// Called (by HbApplication) when QApplication is constructed and the splash was
+// launched before that. This gives a chance for the splash screen to do
 // activies that need an active scheduler or a QApplication instance.
 void HbSplashScreenExt::doQtPhase()
 {
+    // Can also be called when the splash screen was not started or is already
+    // destroyed, do nothing in such cases.
     if (splashScreen) {
 #ifdef HB_SPLASH_DIRECT_WS
         static_cast<HbSplashScreenSymbianVg *>(splashScreen)->doQtPhase();
@@ -581,6 +583,21 @@
             RDebug::Printf("[hbsplash] drawing took %d ms", (int) t.elapsed());
 #endif
 
+            bool isQtAvailable = QCoreApplication::instance() != 0;
+#ifdef HB_SPLASH_VERBOSE_LOGGING
+            RDebug::Printf("[hbsplash] qapplication present: %d", isQtAvailable);
+#endif
+            if (isQtAvailable) {
+                doQtPhase();
+            }
+            // If there is no QApplication then there is no active scheduler,
+            // cone, etc. either so defer the creation of the timer and the
+            // visibility listener. doQtPhase() will be called later by
+            // HbApplication when QApplication is constructed. If HbApplication
+            // is not used at all and start() is called before instantiating
+            // QApplication then doQtPhase() is never called but there is not
+            // much we can do and it is not mandatory anyway.
+
         } else {
             HbSplashScreen::destroy();
         }