  class Q_CORE_EXPORT QThreadPool : public QObject
  {
      Q_OBJECT
-@@ -86,6 +112,10 @@
+@@ -69,6 +97,7 @@
+     ~QThreadPool();
+ 
+     static QThreadPool *globalInstance();
++    static void setGlobalInstance(QThreadPool* instance);
+ 
+     void start(QRunnable *runnable, int priority = 0);
+     bool tryStart(QRunnable *runnable);
+@@ -86,6 +115,10 @@
  
      void waitForDone();
      bool waitForDone(int msecs);

--- src/corelib/concurrent/qthreadpool.cpp.orig	2015-05-07 16:14:48.000000000 +0200
+++ src/corelib/concurrent/qthreadpool.cpp	2016-03-17 15:57:50.000000000 +0100
@@ -42,6 +42,7 @@
 #include "qthreadpool.h"
 #include "qthreadpool_p.h"
 #include "qelapsedtimer.h"
+#include "QtCore/qcoreapplication.h"
 
 #ifndef QT_NO_THREAD
 
@@ -56,23 +57,6 @@
     return priority < p.second;
 }
 

     allThreads.insert(thread.data());
     ++activeThreads;
 
@@ -444,7 +436,13 @@
 */
 QThreadPool *QThreadPool::globalInstance()
 {
-    return theInstance();
+    return gThreadPool.data();
+}
+
+void
+QThreadPool::setGlobalInstance(QThreadPool* instance)
+{
+    gThreadPool.reset(instance);
 }
 
 /*!
--- src/corelib/concurrent/qthreadpool.h.orig	2015-05-07 16:14:48.000000000 +0200
+++ src/corelib/concurrent/qthreadpool.h	2016-03-18 11:01:55.000000000 +0100
@@ -46,15 +46,43 @@
 
 #include <QtCore/qthread.h>
 #include <QtCore/qrunnable.h>
