New bug about arc in GPUImageFilter on iOS4.3.3
Hi, my project crashed when open the camera with transform filter on iOS 4.3.3. My xCode is 4.3.1 and SDK is 5.1. The error is that:
2012-05-17 11:34:50.616 Test[4031:9807] *** __NSAutoreleaseNoPool(): Object 0x33d700 of class NSCFString autoreleased with no pool in place - just leaking 2012-05-17 11:34:50.617 Test[4031:9807] *** __NSAutoreleaseNoPool(): Object 0x330c40 of class NSPathStore2 autoreleased with no pool in place - just leaking 2012-05-17 11:34:50.618 Test[4031:9807] *** __NSAutoreleaseNoPool(): Object 0x336160 of class NSURL autoreleased with no pool in place - just leaking dyld: lazy symbol binding failed: Symbol not found: _objc_retain Referenced from: /var/mobile/Applications/D1210DCD-E47A-4C5E-A1F3-CF391E9C78B4/Test.app/Test Expected in: /usr/lib/libobjc.A.dylib
I think it is caused by the arc. And it's quite well on iOS 5.0+. The problem is in the method:
- (id)initWithVertexShaderFromString:(NSString *)vertexShaderString fragmentShaderFromString:(NSString *)fragmentShaderString;
in GPUImageFilter. Can you help me to fix that? Thank you!
That's not an ARC issue. You're trying to initialize this filter on a background thread. Don't do that. The framework is not yet threadsafe, so all operations against it must be performed on the main thread.
Look at the FilterShowcase, where this same transform filter is allocated and connected to a camera on the main thread, and this throws no such console errors.
Hi BradLarson, I rewrite my code but it doesn't work, though I put the init into the viewDidLoad. It occurred in the GPUImageFilter not the child class. And I try the showcase proj. That works quite well. I do not know how to fix it TAT.
The error of this time:
dyld: lazy symbol binding failed: Symbol not found: _objc_retain Referenced from: /var/mobile/Applications/D1210DCD-E47A-4C5E-A1F3-CF391E9C78B4/Test.app/Test Expected in: /usr/lib/libobjc.A.dylib
dyld: Symbol not found: _objc_retain Referenced from: /var/mobile/Applications/D1210DCD-E47A-4C5E-A1F3-CF391E9C78B4/Test.app/Test Expected in: /usr/lib/libobjc.A.dylib
It sounds like you are trying to build a non-ARC application targeting iOS 4.x. As I state in the installation instructions, for that case you need to add -fobjc-arc to the Other Linker Flags for your application project in order for the ARC support library to be built into your application. That will remove this error.
I add -fobjc-arc but there is another error that the #issue 59# mentioned. https://github.com/BradLarson/GPUImage/issues/59
and I found this: http://www.sunsetlakesoftware.com/forum/app-crashes-ios-43 It sounds like the proj doesn't recoganize the -fobjc-arc? I do change the framework to optional, but still not work with the same error.
I try to find the key point and got this code:
- (BOOL)supportsFastTextureUpload; { if (CVOpenGLESTextureCacheCreate != NULLl) { NSLog(@"yes:%@",CVOpenGLESTextureCacheCreate); }else { NSLog(@"no"); } return (CVOpenGLESTextureCacheCreate != NULL); }
The result is the log printed "yes:(null)" As this result, it jump into the code:
if ([GPUImageOpenGLESContext supportsFastTextureUpload]) { [GPUImageOpenGLESContext useImageProcessingContext]; CVReturn err = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, NULL, (__bridge void *)[[GPUImageOpenGLESContext sharedImageProcessingOpenGLESContext] context], NULL, &coreVideoTextureCache); if (err) { NSAssert(NO, @"Error at CVOpenGLESTextureCacheCreate %d"); }
// Need to remove the initially created texture
[self deleteOutputTexture];
}
So I don't think it's a correct step, do I?
Can you replicate this with any of the sample applications? If not, look and see what's different between your application and that.