summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-10 09:54:23 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-10 09:55:09 +0100
commit51ce5b482997f76b8890876b07337b29609728e5 (patch)
tree54f408028c7831428fca2772c6a909f2febffb54 /src/corelib/kernel
parent51ba25e0fc89882e5021bed718de91d58f7f3907 (diff)
parentd6ce94ae6367337ade2c590f182b973e2bcfa98c (diff)
Merge remote-tracking branch 'origin/5.4.1' into 5.4
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ca3d92bad1..6b0ebf8b8b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -81,6 +81,11 @@
#ifdef Q_OS_WIN
# ifdef Q_OS_WINRT
# include "qeventdispatcher_winrt_p.h"
+# include "qfunctions_winrt.h"
+# include <wrl.h>
+# include <Windows.ApplicationModel.core.h>
+ using namespace ABI::Windows::ApplicationModel::Core;
+ using namespace Microsoft::WRL;
# else
# include "qeventdispatcher_win_p.h"
# endif
@@ -1221,6 +1226,19 @@ void QCoreApplication::exit(int returnCode)
QEventLoop *eventLoop = data->eventLoops.at(i);
eventLoop->exit(returnCode);
}
+#ifdef Q_OS_WINRT
+ qWarning("QCoreApplication::exit: It is not recommended to explicitly exit an application on Windows Store Apps");
+ ComPtr<ICoreApplication> app;
+ HRESULT hr = RoGetActivationFactory(Wrappers::HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
+ IID_PPV_ARGS(&app));
+ RETURN_VOID_IF_FAILED("Could not acquire ICoreApplication object");
+ ComPtr<ICoreApplicationExit> appExit;
+
+ hr = app.As(&appExit);
+ RETURN_VOID_IF_FAILED("Could not acquire ICoreApplicationExit object");
+ hr = appExit->Exit();
+ RETURN_VOID_IF_FAILED("Could not exit application");
+#endif // Q_OS_WINRT
}
/*****************************************************************************