部分用户绘制 NSWindow 时出现 CGContextSetCompositeOperation 错误
我编写的一个简单的 10.6 Cocoa 应用程序基本上绘制了一个带有一些按钮和文本的常规窗口,并且一直在喷出数百条控制台日志消息:
<Error>: CGContextSetCompositeOperation: invalid context 0x0
我不直接调用drawRect:并且当我需要刷新时总是使用setNeedsDisplay:YES。
有趣的是,这个错误并不是在所有机器上都会发生,我想说大约 50% 的机器都会出现这个错误。然而,该程序在任何一种情况下都可以正常工作!
任何人都知道这个错误的含义、它的根源,更重要的是,我如何抑制/摆脱它?
谢谢
A simple 10.6 Cocoa app I wrote that basically draws a regular window with some buttons and text has been spewing hundreds of console log messages:
<Error>: CGContextSetCompositeOperation: invalid context 0x0
I do not directly call drawRect: and always use setNeedsDisplay:YES when I need to refresh.
Interestingly, this error does not happen on all machines, I'd say about 50% get the error. However, the program works fine in either case!
Anyone got any clue as to what this error means, where it's stemming from, and more importantly, how can I suppress/get rid of it?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 CGPostError 上设置断点。如果您可以中断日志记录,您就有希望弄清楚发生了什么。
你不应该只是想压制它。这意味着上下文创建失败(因此某些上下文参数传递了 NULL),这不好。
Try setting a breakpoint on CGPostError. If you can break on the logging, you can hopefully figure out what's going on.
You shouldn't be looking to just suppress it. It means context creation is failing (thus NULL gets passed for some context parameter), and that's not good.