From d57bd8450ed96196f11f7e7f024a75a182750632 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Thu, 27 Dec 2018 18:34:51 +0100 Subject: Thread safe redirect for controller applications --- cpp/test/uwp/controller/ControllerView.xaml.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cpp/test/uwp/controller/ControllerView.xaml.cpp') diff --git a/cpp/test/uwp/controller/ControllerView.xaml.cpp b/cpp/test/uwp/controller/ControllerView.xaml.cpp index 4d17ef2960b..2a118ee658b 100644 --- a/cpp/test/uwp/controller/ControllerView.xaml.cpp +++ b/cpp/test/uwp/controller/ControllerView.xaml.cpp @@ -131,6 +131,8 @@ private: shared_ptr _registry; }; +Test::StreamHelper streamRedirect; + } ControllerHelperI::ControllerHelperI(const string& dll, const StringSeq& args) : @@ -199,10 +201,13 @@ ControllerHelperI::run() argv[i] = const_cast(_args[i].c_str()); } argv[_args.size()] = 0; + + if(_dll.find("client") != string::npos || _dll.find("collocated") != string::npos) + { + streamRedirect.setControllerHelper(this); + } try { - StreamHelper streamHelper(this, - _dll.find("client") != string::npos || _dll.find("collocated") != string::npos); auto helper = unique_ptr(createHelper()); helper->setControllerHelper(this); helper->run(static_cast(_args.size()), argv); @@ -218,6 +223,10 @@ ControllerHelperI::run() print("unexpected unknown exception while running `" + _args[0] + "'"); completed(1); } + if(_dll.find("client") != string::npos || _dll.find("collocated") != string::npos) + { + streamRedirect.setControllerHelper(0); + } delete[] argv; }); _thread = move(t); -- cgit v1.2.3