Skip to content

Commit 83ef606

Browse files
Deallocator of SyclEvent calls Wait/Delete only if _event_ref != NULL
1 parent fdb3919 commit 83ef606

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dpctl/_sycl_event.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ cdef class _SyclEvent:
8888
"""
8989

9090
def __dealloc__(self):
91-
DPCTLEvent_Wait(self._event_ref)
92-
DPCTLEvent_Delete(self._event_ref)
91+
if (self._event_ref):
92+
DPCTLEvent_Wait(self._event_ref)
93+
DPCTLEvent_Delete(self._event_ref)
94+
self._event_ref = NULL
9395
self.args = None
9496

9597

0 commit comments

Comments
 (0)