Re: unrecognized selector retainedCGImage


Quincey Morris
 

On Feb 19, 2019, at 02:57 , Jonathan Taylor <jonathan.taylor@...> wrote:

The problem is that as far as I can see this is something internal to AppKit

I suggest that you start with most mundane possibility, that this is a zombie object.

My guess is that this is one of those crashes that can happen when breaking down a UI, such as when a window is closing. It’s easy to have a dangling reference to a weakly reference object that no longer exists.

This is based on seeing:

20  Spim GUI                            0x000df4cc __36-[SpimApplication stopVideoSession:]_block_invoke + 460

in the backtrace, trickling down to a KVO observer being notified:

9   Spim GUI                            0x00141977 -[GUIMovieBuilder observeValueForKeyPath:ofObject:change:context:] + 119

which then looks like it’s trying to *create* a NSImage:

8   Spim GUI                            0x001416b3 -[GUIMovieBuilder updateCurrentFrameImage] + 1747

which looks like it’s trying use some current window or view context:

5   AppKit                              0x903d7ed8 +[NSCGImageSnapshotRep _unlockFocusAndPerformBlockUsingCGImageAndCapturingContext:] + 129

If the window has already destroyed its view hierarchy, this might not work so well.

Unfortunately, this isn’t an easy kind of problem to debug. The answer is usually to nil some non-owning “delegate” reference somewhere, but finding where and when can be challenging.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.