You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AsioDriverList needs a balanced call of CoInitialize/CoUninitialize just like, e.g., RtApiAsio, RtApiDs, or RtApiWasapi. The thing is that, if the application earlier already initialized COM using multithreading, then CoInitialize( NULL ) in the constructor of AsioDriverList will fail with RPC_E_CHANGED_MODE, in which case you must NOT call CoUninitialize() in the destructor, because if you do so, you are one uninit-call ahead, which causes a fail fast exception at the final CoUninitialize() at least in my code and I wouldn't know how to prevent this. The solution is to introduce a bool flag just like in RtApiDs and other parts of the code, e.g.:
destructor code: if ( coInitialized_ ) CoUninitialize(); // balanced call.
idk if additional error handlingis required if the mode is not single-threaded apartment (which it would be in my case), frankly, idk what the reason for this requirement is in the first place, but what I do know is that there is an extra call of CoUninitialize.
The text was updated successfully, but these errors were encountered:
AsioDriverList
needs a balanced call ofCoInitialize
/CoUninitialize
just like, e.g.,RtApiAsio
,RtApiDs
, orRtApiWasapi
. The thing is that, if the application earlier already initialized COM using multithreading, thenCoInitialize( NULL )
in the constructor of AsioDriverList will fail withRPC_E_CHANGED_MODE
, in which case you must NOT callCoUninitialize()
in the destructor, because if you do so, you are one uninit-call ahead, which causes a fail fast exception at the finalCoUninitialize()
at least in my code and I wouldn't know how to prevent this. The solution is to introduce a bool flag just like inRtApiDs
and other parts of the code, e.g.:constructor code:
coInitialized_ = false; HRESULT hr = CoInitialize( NULL ); if ( !FAILED( hr ) ) coInitialized_ = true;
destructor code:
if ( coInitialized_ ) CoUninitialize(); // balanced call.
idk if additional error handlingis required if the mode is not single-threaded apartment (which it would be in my case), frankly, idk what the reason for this requirement is in the first place, but what I do know is that there is an extra call of
CoUninitialize
.The text was updated successfully, but these errors were encountered: