Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect where NaN is passing to CoreGraphics API on Mac OS X 10.9

I have very large graphic Mac app and now I receive a lot of the following messages in Console on 10.9 GM.

<Error>: Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API. This is a serious error and contributes to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. 

I noticed that these messages appear in debugger after calling [NSApp nextEventMatchingMask: untilDate inMode: dequeue] but I think the reasons are in some other places. But I have too many places where I use Cocoa Graphics. I didn't receive this kind of message before 10.9.

How to detect where NaN is passing to CoreGraphics API?

Screenshot for this error on console

like image 956
Igor Avatar asked Oct 04 '13 17:10

Igor


People also ask

What is core graphics on OS X?

Core Graphics is Apple’s 2D drawing engine for OS X. Discover how to build a great disc info app for OS X using Core Graphics to draw charts in this Core Graphics on OS X tutorial. Update 9/22/16: This tutorial has been updated for Xcode 8 and Swift 3. You’ve seen a lot of apps that depict beautiful graphics and stylish custom views.

What can you do with Core Graphics?

Handle path-based drawing, antialiased rendering, gradients, images, color management, PDF documents, and more. The Core Graphics framework is based on the Quartz advanced drawing engine. It provides low-level, lightweight 2D rendering with unmatched output fidelity.

What is the Core Graphics framework?

The Core Graphics framework is based on the Quartz advanced drawing engine. It provides low-level, lightweight 2D rendering with unmatched output fidelity.

What is diskinfo in core graphics?

It has capacity to draw anything you can imagine, from simple shapes and text to more complex visual effects that include shadows and gradients. In this Core Graphics on macOS tutorial, you’ll build up an app named DiskInfo to create a custom view that displays the available space and file distribution of a hard drive.


2 Answers

After much digging around, I've found you can set a symbolic breakpoint on "CGPostError" in Xcode, and that will give you a stack trace.

like image 71
Tom Dalling Avatar answered Oct 01 '22 11:10

Tom Dalling


I was getting this error when I was foolishly retaining an NSPopover for future use.

It seems popover.showRelativeToRect(_:) is all you need to do, and then you can forget about it.

like image 31
Chris Avatar answered Oct 01 '22 11:10

Chris