Skip to content

NSOperation fixes#52

Merged
will-velazquez merged 4 commits into
masterfrom
fix/will/nsoperation-leaks
Apr 7, 2026
Merged

NSOperation fixes#52
will-velazquez merged 4 commits into
masterfrom
fix/will/nsoperation-leaks

Conversation

@will-velazquez

Copy link
Copy Markdown

Couple of small fixes while investigating what I thought was an NSOperation leak (turned out to be a libdispatch setting).

  • Avoid blocks in GNUstep objc code to ensure retain/release semantics are correct
  • Fix a possible race condition when scheduling NSOperations. In practice these are very rare since addOperationWithBlock: is most common, and that's autoreleased
  • Fix not resetting thread priority when there's an exception during an operation

Threads A and B

A: `removeObjectAtIndex` - retain count = 1
B: `release` - NSOperation is `dealloc`'d
A: `addObject` with a destroyed NSOperation instance
I'm not sure that the block version doesn't leak the block itself, so instead use the function version to avoid retain/release questions
@will-velazquez will-velazquez merged commit f60d99e into master Apr 7, 2026
2 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants