Skip to content

Commit 0cc8907

Browse files
committed
Make the CCoInitializer constructor exception safe
1 parent 3196a2c commit 0cc8907

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎docs/parallel/concrt/codesnippet/CPP/walkthrough-using-the-concurrency-runtime-in-a-com-enabled-application_3.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ class CCoInitializer
88
{
99
// Initialize the COM library on the current thread.
1010
HRESULT hr = CoInitializeEx(NULL, dwCoInit);
11-
if (FAILED(hr))
12-
throw hr;
13-
_coinitialized = true;
11+
if (hr == S_OK)
12+
_coinitialized = true;
1413
}
1514
~CCoInitializer()
1615
{

0 commit comments

Comments
 (0)