winrt: Register ssl socket upgrade callback in Xaml thread

Task-number: QTBUG-65354
Change-Id: If628c73b05854c13086708c193995062c8b9f9e4
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Oliver Wolff 2017-12-19 14:30:59 +01:00
parent 17d231039b
commit 33a72ee6f3

View File

@ -47,6 +47,7 @@
#include <QtCore/QSysInfo>
#include <QtCore/qfunctions_winrt.h>
#include <private/qnativesocketengine_winrt_p.h>
#include <private/qeventdispatcher_winrt_p.h>
#include <windows.networking.h>
#include <windows.networking.sockets.h>
@ -443,8 +444,11 @@ void QSslSocketBackendPrivate::continueHandshake()
return;
}
hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(
this, &QSslSocketBackendPrivate::onSslUpgrade).Get());
hr = QEventDispatcherWinRT::runOnXamlThread([this, op]() {
HRESULT hr = op->put_Completed(Callback<IAsyncActionCompletedHandler>(
this, &QSslSocketBackendPrivate::onSslUpgrade).Get());
return hr;
});
Q_ASSERT_SUCCEEDED(hr);
}