I have some NSViews that come and go during printing, and I want them to dealloc soon rather than waiting until the whole printing process is finished. The problem is that inside -[NSView addSubview:]
, the subview gets retained several times, and one of those schedules a release using CFRunLoopPerformBlock
. But I don't have a run loop running, so that's not happening. The documentation of CFRunLoopPerformBlock
says
If you want the work performed right away, you must explicitly wake up that thread using the
CFRunLoopWakeUp
function.
But calling CFRunLoopWakeUp( CFRunLoopGetMain() )
does not help, probably because the run loop is not running. If I call -[NSApplication nextEventMatchingMask: ...]
in one of the standard modes, then the block from CFRunLoopPerformBlock
runs, but too much other stuff also runs, such as queued notifications.