Fix order of calling CoUninitialize()
[rtaudio-cdist.git] / RtAudio.cpp
index 91bd22165290c13c919f8b26d5de65fb9273877d..fa365f76f2040f40a79b11fd3e6305750ef634d4 100644 (file)
@@ -5363,8 +5363,8 @@ RtApiDs :: RtApiDs()
 \r
 RtApiDs :: ~RtApiDs()\r
 {\r
-  if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
   if ( stream_.state != STREAM_CLOSED ) closeStream();\r
+  if ( coInitialized_ ) CoUninitialize(); // balanced call.\r
 }\r
 \r
 // The DirectSound default output is always the first device.\r