On 26 Jul 2017, at 2:22 pm, Quincey Morris <quinceymorris@...> wrote:There’s still some “magic” about blocks I’m not altogethr clear about. When are blocks, as an actual object, created? At what point do they retain their references?
I ask because I wonder if there’s a chance that just leaving it to the block to do the retaining could lead to a window of opportunity for the object (‘self’) that it’s retaining to be autoreleased from out under it. For example, if the call to -beginSheet ends up with NSApp, will it do so after draining the current autorelease pool?
I imagine the answer’s no, and to be sure doing the extra retains myself makes sure, but I just want to know whether my previous code (with no retain/release at all) is susceptible to a race condition of some sort.
Definitely, which is why I’m making sure what I’m doing is legit.