diff options
author | Jose <jose@zeroc.com> | 2018-03-29 10:25:58 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-03-29 10:25:58 +0200 |
commit | 6153be8a23aec4ef162fc18a1aaa4cfc0d401245 (patch) | |
tree | 42a920f2d6fc2c781a210c47151c2a2c105ced70 /cpp/test/uwp/controller | |
parent | ESLINT configuration (diff) | |
download | ice-6153be8a23aec4ef162fc18a1aaa4cfc0d401245.tar.bz2 ice-6153be8a23aec4ef162fc18a1aaa4cfc0d401245.tar.xz ice-6153be8a23aec4ef162fc18a1aaa4cfc0d401245.zip |
Do not unload DLLs with UWP test controller
Unloading DLLs in UWP controller was causing an AccessViolation.
Diffstat (limited to 'cpp/test/uwp/controller')
-rw-r--r-- | cpp/test/uwp/controller/ViewController.xaml.cpp | 28 | ||||
-rw-r--r-- | cpp/test/uwp/controller/ViewController.xaml.h | 2 |
2 files changed, 4 insertions, 26 deletions
diff --git a/cpp/test/uwp/controller/ViewController.xaml.cpp b/cpp/test/uwp/controller/ViewController.xaml.cpp index a2d953ad84d..99d594fb81e 100644 --- a/cpp/test/uwp/controller/ViewController.xaml.cpp +++ b/cpp/test/uwp/controller/ViewController.xaml.cpp @@ -197,7 +197,6 @@ MainHelperI::run() if(_dllTestShutdown == 0) { print("failed to find dllTestShutdown function from `" + _dll + "'"); - _controller->unloadDll(_dll); completed(EXIT_FAILURE); return; } @@ -206,7 +205,6 @@ MainHelperI::run() if(sym == 0) { print("failed to find dllMain function from `" + _dll + "'"); - _controller->unloadDll(_dll); completed(EXIT_FAILURE); return; } @@ -233,7 +231,6 @@ MainHelperI::run() completed(EXIT_FAILURE); } delete[] argv; - _controller->unloadDll(_dll); }); _thread = move(t); } @@ -491,36 +488,17 @@ HINSTANCE ViewController::loadDll(const string& name) { unique_lock<mutex> lock(_mutex); - map<string, pair<HINSTANCE, unsigned int>>::iterator p = _dlls.find(name); + map<string, HINSTANCE>::iterator p = _dlls.find(name); if(p == _dlls.end()) { HINSTANCE hnd = LoadPackagedLibrary(Ice::stringToWstring(name).c_str(), 0); - p = _dlls.insert(make_pair(name, make_pair(hnd, 0))).first; - } - ++p->second.second; - return p->second.first; -} - -void -ViewController::unloadDll(const string& name) -{ - unique_lock<mutex> lock(_mutex); - map<string, pair<HINSTANCE, unsigned int>>::iterator p = _dlls.find(name); - assert(p != _dlls.end()); - if(--p->second.second == 0) - { - FreeLibrary(p->second.first); - _dlls.erase(p); + p = _dlls.insert(make_pair(name, hnd)).first; } + return p->second; } ViewController::~ViewController() { - for(map<string, pair<HINSTANCE, unsigned int>>::const_iterator p = _dlls.begin(); p != _dlls.end(); ++p) - { - FreeLibrary(p->second.first); - } - if(controllerHelper) { delete controllerHelper; diff --git a/cpp/test/uwp/controller/ViewController.xaml.h b/cpp/test/uwp/controller/ViewController.xaml.h index 97fc0910e78..ea4919b6ff9 100644 --- a/cpp/test/uwp/controller/ViewController.xaml.h +++ b/cpp/test/uwp/controller/ViewController.xaml.h @@ -45,7 +45,7 @@ private: std::string getHost() const; void Hostname_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); - std::map<std::string, std::pair<HINSTANCE, unsigned int>> _dlls; + std::map<std::string, HINSTANCE> _dlls; std::mutex _mutex; }; |