File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2046,7 +2046,8 @@ pi_result piContextRelease(pi_context Context) {
2046
2046
PI_ASSERT (Context, PI_INVALID_CONTEXT);
2047
2047
2048
2048
if (--(Context->RefCount ) == 0 ) {
2049
- auto ZeContext = Context->ZeContext ;
2049
+ ze_context_handle_t DestoryZeContext =
2050
+ Context->OwnZeContext ? Context->ZeContext : nullptr ;
2050
2051
2051
2052
// Clean up any live memory associated with Context
2052
2053
pi_result Result = Context->finalize ();
@@ -2060,9 +2061,8 @@ pi_result piContextRelease(pi_context Context) {
2060
2061
// and therefore it must be valid at that point.
2061
2062
// Technically it should be placed to the destructor of pi_context
2062
2063
// but this makes API error handling more complex.
2063
- if (Context->OwnZeContext ) {
2064
- ZE_CALL (zeContextDestroy (ZeContext));
2065
- }
2064
+ if (DestoryZeContext)
2065
+ ZE_CALL (zeContextDestroy (DestoryZeContext));
2066
2066
2067
2067
return Result;
2068
2068
}
You can’t perform that action at this time.
0 commit comments