Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored Oct 8, 2023
1 parent de5beac commit 4d121f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/platform/dnne.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ enum failure_type
{
failure_load_runtime = 1,
failure_load_export,
failure_get_current_app_domain_id,
failure_get_current_app_domain_id_backup_try
};
typedef void (DNNE_CALLTYPE* failure_fn)(enum failure_type type, int error_code);

Expand Down
27 changes: 13 additions & 14 deletions src/platform/platform_v4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,24 @@ namespace
// Release all other CLR resources
(void)metahost->Release();


// Start the runtime
hr = runtimeHost->Start();
IF_FAILURE_RETURN_OR_ABORT(ret, failure_load_runtime, hr, &_prepare_lock);

hr = runtimeHost->GetCurrentAppDomainId(&_appDomainId);
if (hr != S_OK)
{
ICorRuntimeHost* oldRuntimeHost;
hr = runtimeInfo->GetInterface(CLSID_CorRuntimeHost, IID_ICorRuntimeHost, (void**)&oldRuntimeHost);
IF_FAILURE_RETURN_OR_ABORT(ret, failure_get_current_app_domain_id_backup_try, hr, &_prepare_lock);
IUnknown* pUnk2;
hr = oldRuntimeHost->GetDefaultDomain(&pUnk2);
IF_FAILURE_RETURN_OR_ABORT(ret, failure_get_current_app_domain_id_backup_try, hr, &_prepare_lock);
hr = runtimeHost->GetCurrentAppDomainId(&_appDomainId);
}
(void)runtimeInfo->Release();//can't release earlierincase backup failure

IF_FAILURE_RETURN_OR_ABORT(ret, failure_get_current_app_domain_id, hr, &_prepare_lock);
if (hr != S_OK)
{
ICorRuntimeHost* oldRuntimeHost;
hr = runtimeInfo->GetInterface(CLSID_CorRuntimeHost, IID_ICorRuntimeHost, (void**)&oldRuntimeHost);
IF_FAILURE_RETURN_OR_ABORT(ret, failure_load_runtime, hr, &_prepare_lock);
IUnknown* pUnk2;
hr = oldRuntimeHost->GetDefaultDomain(&pUnk2);
IF_FAILURE_RETURN_OR_ABORT(ret, failure_load_runtime, hr, &_prepare_lock);
hr = runtimeHost->GetCurrentAppDomainId(&_appDomainId);
}
(void)runtimeInfo->Release(); //can't release earlier incase backup failure

IF_FAILURE_RETURN_OR_ABORT(ret, failure_load_runtime, hr, &_prepare_lock);
(void)runtimeHost->QueryInterface(__uuidof(ICLRPrivRuntime), (void**)&_host);
(void)runtimeHost->Release();
assert(_host != nullptr);
Expand Down

0 comments on commit 4d121f7

Please sign in to comment.