BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.23k stars 4.61k forks source link

Adding GPUImageView on OSX crashes #1974

Open Phando opened 9 years ago

Phando commented 9 years ago

Hey All, In the past I have made several iOS GPUImage projects. This is my first OSX GPUImage project. Currently I am modeling my project after the SimpleVideoFIlter project. Any time I add a GPUImageView to my ViewControllers view, programmatically or via the storyboard, the app crashes. The app is constantly crashing on line 30 of runSynchronouslyOnVideoProcessingQueue with the error below.

2015-04-26 23:04:25.858 Duckhunt[10537:680723] *** Assertion failure in -[GPUImageView lockFocus], /SourceCache/AppKit/AppKit-1344.72/AppKit.subproj/NSView.m:7612
2015-04-26 23:04:25.867 Duckhunt[10537:680723] An uncaught exception was raised
2015-04-26 23:04:25.867 Duckhunt[10537:680723] -[GPUImageView(0x100709310) lockFocus] failed with window=0x6000001e0400, windowNumber=-1, [self isHiddenOrHasHiddenAncestor]=0

My desired view hierarchy is RootEntry->NSWindow->NSViewController->NSView->GPUImageView

UPDATE - WORKAROUND: I have stopped trying to add the GPUImageView via the storyboard. Calling initWithFrame on the GPUImageView causes the crash above, but calling init does not.

For now I am using the code below and the GPUImageView is behaving nicely:

// Causes Crash
//self.cameraView = [[GPUImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];

// Weird but works    
self.cameraView = [[GPUImageView alloc] init];
[self.view addSubview:self.cameraView];
[self.cameraView setFrame:CGRectMake(0, 0, 200, 200)];

Thanks in advance, Joe

joelteply commented 9 years ago

The iPhone 4s and maybe perhaps some iPad devices will crash if your scheme in Xcode has GPU Logging turned on, the default behavior. This logs fps and other things. It's an apple xcode bug, so just turn it off when using this device.