From 1f31c6c6b1f4b37806aa5c1c426efb31ac78ed5e Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Sun, 5 Jan 2014 01:56:38 +0200 Subject: WinRT: Properly return exit code Instead of returning the HRESULT of the Run method, return the actual exit code of the application. Change-Id: I1e3d654ecdb4c319d4a08fe8a11e8699d186f66b Reviewed-by: Oliver Wolff Reviewed-by: Maurice Kalinowski --- src/winmain/qtmain_winrt.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/winmain') diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp index 09efd01667..aead5ca0d0 100644 --- a/src/winmain/qtmain_winrt.cpp +++ b/src/winmain/qtmain_winrt.cpp @@ -77,6 +77,8 @@ using namespace Microsoft::WRL; #define CoreApplicationClass RuntimeClass_Windows_ApplicationModel_Core_CoreApplication typedef ITypedEventHandler ActivatedHandler; +static int g_mainExitCode; + class AppContainer : public Microsoft::WRL::RuntimeClass { public: @@ -109,7 +111,8 @@ public: while (!IsDebuggerPresent()) WaitForSingleObjectEx(GetCurrentThread(), 1, true); } - return main(m_argv.count(), m_argv.data()); + g_mainExitCode = main(m_argv.count(), m_argv.data()); + return S_OK; } HRESULT __stdcall Uninitialize() { return S_OK; } @@ -178,5 +181,6 @@ int WinMain() if (FAILED(RoGetActivationFactory(qHString(CoreApplicationClass), IID_PPV_ARGS(&appFactory)))) return 2; - return appFactory->Run(Make(argc, argv).Get()); + appFactory->Run(Make(argc, argv).Get()); + return g_mainExitCode; } -- cgit v1.2.3