Skip to content

Commit

Permalink
remove direct queue retain call
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel-skrenkovic committed May 7, 2024
1 parent b5f6508 commit 450d650
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ static FSEventStreamRef EventStreamCreate(FSEventStreamContext * context, uintpt
return FSEventStreamCreate(NULL, (FSEventStreamCallback) fsevtCallback, context, paths, since, latency, flags);
}
static void DispatchQueueRetain(dispatch_queue_t queue) {
dispatch_retain(queue);
}
static void DispatchQueueRelease(dispatch_queue_t queue) {
dispatch_release(queue);
}
Expand Down Expand Up @@ -437,16 +433,17 @@ func (es *EventStream) start(paths []string, callbackInfo uintptr) error {
es.stream = setupStream(paths, es.Flags, callbackInfo, since, es.Latency, es.Device)

es.qref = fsDispatchQueueRef(C.dispatch_queue_create(nil, nil))
C.DispatchQueueRetain(es.qref)
C.FSEventStreamSetDispatchQueue(es.stream, es.qref)

if C.FSEventStreamStart(es.stream) == 0 {
// cleanup stream
C.FSEventStreamInvalidate(es.stream)
C.FSEventStreamRelease(es.stream)
C.DispatchQueueRelease(es.qref)
es.stream = nil

C.DispatchQueueRelease(es.qref)
es.qref = nil

return fmt.Errorf("failed to start eventstream")
}

Expand Down

0 comments on commit 450d650

Please sign in to comment.