src/corelib/kernel/qcoreapplication.cpp
changeset 22 79de32ba3296
parent 19 fcece45ef507
child 30 5dc02b23752f
--- a/src/corelib/kernel/qcoreapplication.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/src/corelib/kernel/qcoreapplication.cpp	Fri May 14 16:40:13 2010 +0300
@@ -67,6 +67,7 @@
 #ifdef Q_OS_SYMBIAN
 #  include <exception>
 #  include <f32file.h>
+#  include <e32ldr.h>
 #  include "qeventdispatcher_symbian_p.h"
 #  include "private/qcore_symbian_p.h"
 #elif defined(Q_OS_UNIX)
@@ -579,6 +580,27 @@
     qt_core_eval_init(d->application_type);
 #endif
 
+#if    defined(Q_OS_SYMBIAN)  \
+    && defined(Q_CC_NOKIAX86) \
+    && defined(QT_DEBUG)
+    /**
+     * Prevent the executable from being locked in the Symbian emulator. The
+     * code dramatically simplifies debugging on Symbian, but beyond that has
+     * no impact.
+     *
+     * Force the ZLazyUnloadTimer to fire and therefore unload code segments
+     * immediately. The code affects Symbian's file server and on the other
+     * hand needs only to be run once in each emulator run.
+     */
+    {
+        RLoader loader;
+        CleanupClosePushL(loader);
+        User::LeaveIfError(loader.Connect());
+        User::LeaveIfError(loader.CancelLazyDllUnload());
+        CleanupStack::PopAndDestroy(&loader);
+    }
+#endif
+
     qt_startup_hook();
 }