【问题标题】:What is the CGSUpdateManager and why is it complaining?什么是 CGSUpdateManager,它为什么抱怨?
【发布时间】:2015-02-02 12:32:00
【问题描述】:

我正在处理我的用户界面,试图通过一大堆嵌套的 NSSplitViewControllers、NSTabViewControllers 等来导航我的数据。

有时我会收到这些错误警告。我不知道它们来自哪里,甚至不知道该往哪里看。该应用似乎运行良好。

什么是 CGSUpdateManager,它为什么会抱怨?

void CGSUpdateManager::log() const: conn 0xdbbb token 0x2ffffffffffdc78 Backtrace (at 5543.57):
void CGSUpdateManager::log() const:  0   CoreGraphics                        0x00007fff85db9215 CGSBacktraceCreate + 59
void CGSUpdateManager::log() const:  1   CoreGraphics                        0x00007fff85dd8688 _ZN16CGSUpdateManager14disable_updateEv + 84
void CGSUpdateManager::log() const:  2   AppKit                              0x00007fff897f3de5 -[NSWindow disableScreenUpdatesUntilFlush] + 127
void CGSUpdateManager::log() const:  3   AppKit                              0x00007fff897b3250 -[NSView _gainedLayerTreeHostAncestor] + 385
void CGSUpdateManager::log() const:  4   AppKit                              0x00007fff897b30ae -[NSView _recursiveGainedLayerTreeHostAncestor] + 27
void CGSUpdateManager::log() const:  5   AppKit                              0x00007fff897b767a -[NSScroller _recursiveGainedLayerTreeHostAncestor] + 103
void CGSUpdateManager::log() const:  6   AppKit                              0x00007fff89a1ea56 -[NSScroller _setSurfaceBacked:] + 213
void CGSUpdateManager::log() const:  7   AppKit                              0x00007fff8998424f -[NSScrollView setScrollerStyle:] + 304
void CGSUpdateManager::log() const:  8   AppKit                              0x00007fff8a01bf27 +[NSScrollerImpPair _updateAllScrollerImpPairsForNewRecommendedScrollerStyle:] + 426
void CGSUpdateManager::log() const:  9   CoreFoundation                         0x00007fff914b5cbc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
void CGSUpdateManager::log() const:  10  CoreFoundation                      0x00007fff913a71b4 _CFXNotificationPost + 3140
void CGSUpdateManager::log() const:  11  Foundation                          0x00007fff917feea1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
void CGSUpdateManager::log() const:  12  CoreFoundation                      0x00007fff9141754c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
void CGSUpdateManager::log() const:  13  CoreFoundation                      0x00007fff91409655 __CFRunLoopDoBlocks + 341
void CGSUpdateManager::log() const:  14  CoreFoundation                      0x00007fff91409196 __CFRunLoopRun + 1814
void CGSUpdateManager::log() const:  15  CoreFoundation                      0x00007fff91408838 CFRunLoopRunSpecific + 296
void CGSUpdateManager::log() const:  16  HIToolbox                           0x00007fff8f30743f RunCurrentEventLoopInMode + 235
void CGSUpdateManager::log() const:  17  HIToolbox                             0x00007fff8f3071ba ReceiveNextEventCommon + 431
void CGSUpdateManager::log() const:  18  HIToolbox                           0x00007fff8f306ffb _BlockUntilNextEventMatchingListInModeWithFilter + 71
void CGSUpdateManager::log() const:  19  AppKit                              0x00007fff897376d1 _DPSNextEvent + 964
void CGSUpdateManager::log() const:  20  AppKit                              0x00007fff89736e80 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
void CGSUpdateManager::log() const:  21  AppKit                              0x00007fff8972ae23 -[NSApplication run] + 594
void CGSUpdateManager::log() const:  22  AppKit                              0x00007fff897162d4 NSApplicationMain + 1832
void CGSUpdateManager::log() const:  23  Well                                0x0000000100019422 top_level_code + 34
void CGSUpdateManager::log() const:  24  Well                                0x000000010001945a main + 42
void CGSUpdateManager::log() const:  25  libdyld.dylib                       0x00007fff85b7b5c9 start + 1

【问题讨论】:

  • 这里也一样。发现自从我升级到优胜美地后,我的应用程序开始抛出这些消息。不知道在哪里看。除此之外,一切似乎都运行良好。您使用的是哪个版本的 OS X?
  • insys,打电话给super。使它成为繁荣的答案。

标签: cocoa swift nsviewcontroller


【解决方案1】:

当我升级到 El Capitan 时,我开始看到同样的问题。

我最终将其追踪到我的代码库深处的一些东西,而这些东西以前没有引起问题……我接到了一个流浪电话:

[NSGraphicsContext restoreCurrentContext];

这一直是个问题...确保平衡这些调用...尤其是在提前返回的函数中!

[NSGraphicsContext saveCurrentContext];
[NSGraphicsContext restoreCurrentContext];

CGContextSaveGState(ctx); CGContextRestoreGState()

【讨论】:

    【解决方案2】:

    确保在 viewDidLoad、viewWillAppear 和 viewWillDisappear 中调用 super。

    【讨论】:

    • 那些超级方法是特定于 uikit 的。问题显然是 appkit。
    • 大部分是在 NSViewController 中定义的。
    猜你喜欢
    • 1970-01-01
    • 2015-06-09
    • 2020-08-12
    • 2016-02-27
    • 1970-01-01
    • 2018-11-17
    • 2022-11-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多