From 08e38c1348639bebea7b7288a40701e4dc8d101a Mon Sep 17 00:00:00 2001
From: Miikka Heikkinen <miikka.heikkinen@digia.com>
Date: Wed, 19 Dec 2012 12:31:54 +0200
Subject: [PATCH] Initialize the event loop for in-process servers in static
 builds.

The event loop doesn't get initialized properly until first time
processEvents() is called. An in-process control that links Qt
statically constructs its own QApplication instance, but nothing
calls processEvents() on it to kickstart event processing, so
the control is unresponsive until something else causes that.

Fixed by explicitly calling processEvents() once after QApplication
instance is created.

Task-number: QTBUG-28716
Change-Id: Id50054082c75d9dce2fb12f0d44fa36601a8fc39
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
 src/activeqt/control/qaxserverbase.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index aca14c34..73a7679d 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -878,6 +878,11 @@ public:
             qax_hhook = SetWindowsHookEx(WH_GETMESSAGE, axs_FilterProc, 0, GetCurrentThreadId());
         }
 
+        // If we created QApplication instance, ensure native event loop starts properly
+        // by calling processEvents.
+        if (qax_ownQApp)
+            qApp->processEvents();
+
 	HRESULT res;
 	// Create the ActiveX wrapper - aggregate if requested
 	if (pUnkOuter) {
-- 
GitLab