File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -6026,20 +6026,25 @@ static pi_result piEventReleaseInternal(pi_event Event) {
6026
6026
PI_CALL (piEventReleaseInternal (Event->HostVisibleEvent ));
6027
6027
}
6028
6028
6029
- // We intentionally incremented the reference counter when an event is
6030
- // created so that we can avoid pi_queue is released before the associated
6031
- // pi_event is released. Here we have to decrement it so pi_queue
6032
- // can be released successfully.
6033
- if (Event->Queue ) {
6034
- PI_CALL (piQueueReleaseInternal (Event->Queue ));
6035
- }
6036
-
6029
+ // Save pointer to the queue before deleting/resetting event.
6030
+ // When we add an event to the cache we need to check whether profiling is
6031
+ // enabled or not, so we access properties of the queue and that's why queue
6032
+ // must released later.
6033
+ auto Queue = Event->Queue ;
6037
6034
if (DisableEventsCaching || !Event->OwnZeEvent ) {
6038
6035
delete Event;
6039
6036
} else {
6040
6037
Event->Context ->addEventToCache (Event);
6041
6038
}
6042
6039
6040
+ // We intentionally incremented the reference counter when an event is
6041
+ // created so that we can avoid pi_queue is released before the associated
6042
+ // pi_event is released. Here we have to decrement it so pi_queue
6043
+ // can be released successfully.
6044
+ if (Queue) {
6045
+ PI_CALL (piQueueReleaseInternal (Queue));
6046
+ }
6047
+
6043
6048
return PI_SUCCESS;
6044
6049
}
6045
6050
You can’t perform that action at this time.
0 commit comments