free-audio / clap-wrapper

Wrappers for using CLAP in other plugin environments
MIT License
124 stars 20 forks source link

macOS standalone request_callback timer #294

Closed MeijisIrlnd closed 3 months ago

MeijisIrlnd commented 3 months ago

Does much the same as the windows PR, but with objc timers - objc isn't my strong suit, so any sanity checking appreciated.

Also, my previous PR for the applicationShouldTerminateAfterLastWindowClosed implementation inadvertently led to a segfault on close, when we reached the section of applicationWillTerminate where the window stuff is freed. According to the docs, [window close] by default calls [window release], so my working theory is that it was leading to a double free when closed that way. To fix it, I implemented windowWillClose, and set the window member to nil there. Then in applicationWillTerminate, I check if self.window=nil, and if it isn't, call [[self window] release], and that seems to have fixed it!

baconpaul commented 3 months ago

The objective c code looks correct to me. The lifetime thing I would have to debug but the code looks ok if it stops your crashing i'm sure its good

only thing is this commit also has the windows commit in it (145c87a) - is that intentional? I thought I had merged that to next so I think it's a rebasing problem more than anything else. This PR looks like it should just be b416128

MeijisIrlnd commented 3 months ago

yeah, I think I must have done something horrible when trying to sync my fork with remote after the last PR got merged, only noticed after I opened this PR - let me figure out what to do about that in the AM!

baconpaul commented 3 months ago

here's what you could do.

in your branch (for now) do

git checkout next
git fetch upstream
git reset upstream/next --hard
git checkout -b macstuff
git cherry-pick b416128
git push origin mastiff

presuming you have upstream set up to point at this repo and origin to point at your fork