开发者

Quartz PDF-context based function fails (occasionally) with BAD_ACCESS

开发者 https://www.devze.com 2023-01-24 14:37 出处:网络
Im Getting a Frequent enough BAD_ACCESS when i call this Quartz function: CGContextDrawPDFPage ((CGContextRef)context, (CGPDFPageRef)pageRef);

Im Getting a Frequent enough BAD_ACCESS when i call this Quartz function:

CGContextDrawPDFPage ((CGContextRef)context, (CGPDFPageRef)pageRef);

Here is how i call it:

CGContextRef context = UIGraphicsGetCurrentContext();
//trans开发者_如何学运维late, scale
CGPDFPageRef myPageRef = CGPDFDocumentGetPage ([PDFDocument sharedPDFDocument].documentData, pageNumber);
CGContextDrawPDFPage (context, myPageRef);//BAD_ACCESS HERE
return UIGraphicsGetImageFromCurrentImageContext();//autoreleased- saved on return
//close context

Neither variable is Nil, or have been released/auto released.

Here is the Stack trace, from the debugger:

Quartz PDF-context based function fails (occasionally) with BAD_ACCESS

Can anyone shed any light on this? Even some pointers on how i might investigate this better. it might not even be function specific. I probobly should mention this function is performed on a separate thread.


Check the documentation for that returns your myPageRef and see if you have to retain it.


At the time of writing the question, UIGraphicsGetImageFromCurrentImageContext and such functions where not thread safe, this was my issue. As of iOs 4.1+ many UI function are now thread safe.

0

精彩评论

暂无评论...
验证码 换一张
取 消