Browse Source

move CoUninitialize to the proper place at the end of the tap thread

Grant Limberg 4 years ago
parent
commit
95da2bcbcf
1 changed files with 1 additions and 1 deletions
  1. 1 1
      osdep/WindowsEthernetTap.cpp

+ 1 - 1
osdep/WindowsEthernetTap.cpp

@@ -648,7 +648,6 @@ WindowsEthernetTap::WindowsEthernetTap(
 WindowsEthernetTap::~WindowsEthernetTap()
 {
 	WinDNSHelper::removeDNS(_nwid);
-	CoUninitialize();
 	_run = false;
 	ReleaseSemaphore(_injectSemaphore,1,NULL);
 	Thread::join(_thread);
@@ -1171,6 +1170,7 @@ void WindowsEthernetTap::threadMain()
 			// We will restart and re-open the tap unless _run == false
 		}
 	} catch ( ... ) {} // catch unexpected exceptions -- this should not happen but would prevent program crash or other weird issues since threads should not throw
+	CoUninitialize();
 }
 
 NET_IFINDEX WindowsEthernetTap::_getDeviceIndex()