I have written a function that convert CIImage to the UIImage, but 1 out of 100 users is experiencing this crash. I can't replicate it and unable to debug it.
12. Crashed: com.apple.root.default-qos
0 CoreImage 0x1adf5c8b0 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 2388
1 CoreImage 0x1adf5c8b0 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 2388
2 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
3 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
4 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
5 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
6 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
7 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
8 CoreImage 0x1adf5c2d8 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 892
9 CoreImage 0x1adf5cef4 CI::Context::render(CI::ProgramNode*, CGRect const&) + 116
10 CoreImage 0x1adf777a4 CI::create_cgimage(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::PixelFormat, bool, unsigned long) + 2392
11 CoreImage 0x1adf15260 -[CIContext(Internal) _createCGImage:fromRect:format:colorSpace:deferred:textureLimit:] + 1020
12 CoreImage 0x1adf13f4c -[CIContext createCGImage:fromRect:] + 196
13 VectorScanner 0x100d98b74 +[AppUtils changeCIImagetoUIImage:] + 560 (AppUtils.m:560)
The function "changeCIImagetoUIImage" is following code:
+ (UIImage *)changeCIImagetoUIImage:(CIImage *)ciimage{
CIContext *context = [AppSharedTool sharedInstance].ciContext;
CGImageRef cgImage = [context createCGImage:ciimage fromRect:ciimage.extent];
UIImage *uiimage = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage);
[context clearCaches];
return uiimage;
}
Also the CIContext is
- (CIContext *)ciContext{
if (!_ciContext) {
_ciContext = [CIContext contextWithOptions:nil];
}
return _ciContext;
}