fix: eager listener cleanup via onXxxDeleted callbacks#420
fix: eager listener cleanup via onXxxDeleted callbacks#420mfazekas wants to merge 2 commits intorive-app:mainfrom
Conversation
Remove premature listener deletion from all 6 delete methods (deleteFile, deleteArtboard, deleteViewModelInstance, deleteImage, deleteFont, deleteAudio). The C++ CommandQueue still holds raw pointers to listeners after deletion, causing EXC_BAD_ACCESS when processMessages() invokes callbacks through dangling pointers. Listeners are already cleaned up in dealloc.
Instead of deferring all listener cleanup to CommandQueue dealloc, clean up listeners as soon as the C++ server confirms deletion via onXxxDeleted callbacks. This prevents listener accumulation when resources are created and destroyed while the Worker stays alive. Dealloc remains as a safety net for bulk teardown (when the Worker itself is released alongside all resources). Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
I like the idea, but I'm a little hesitant on reusing the c++ listeners to delegate back to the command queue. I'd like to keep that as just a listener that forwards to an observer / delegate to bridge to ObjC, if possible. Granted, it is one way to do it. The other way I was thinking is that if you look at |
Summary
dealloc, listeners are now eagerly cleaned up viaonXxxDeletedcallbacks when the C++ server confirms deletiondeallocremains as safety net for bulk teardown when everything is released at once