1
我似乎有一個主要的崩潰問題與創建和銷燬NSPopover對象。 NSPopover被設置爲一個實例變量。即使檢查popover是否爲零,如果不是,它仍然以SIGSEGV結尾。我一直在試圖解決這個問題幾個小時,並沒有拿出任何東西。NSPopover崩潰
- (void)addMenuIconPopup
{
MenuPopupViewController *popoverController = [[MenuPopupViewController alloc] init];
if(menuIconPopover != nil) {
[self removeMenuIconPopup];
}
menuIconPopover = [[NSPopover alloc] init];
[menuIconPopover setContentViewController:popoverController];
[menuIconPopover showRelativeToRect:[[statusItem view] frame]
ofView:[statusItem view]
preferredEdge:NSMinYEdge];
}
- (void)removeMenuIconPopup
{
if(menuIconPopover != nil) {
[menuIconPopover close];
menuIconPopover = nil;
}
}
編輯:看來,NSPopover本身導致掛起。以下是過程樣本的相關部分(空白可能在NDA下的部分)。
2762 Thread_2921859
2762 thread_start (in libsystem_c.dylib) + 13 [0x7fff8f0011e1]
2762 _pthread_start (in libsystem_c.dylib) + 327 [0x7fff8f0147a2]
2762 ??? (in variouslibrary.dylib) load address 0x1000cd000 + 0xb9461 [0x100186461]
2762 ??? (in variouslibrary.dylib) load address 0x1000cd000 + 0x26390 [0x1000f3390]
2762 VariousControllerDelegateListener::onConnect(VariousController::Controller const&) (in App) + 93 [0x10001d4cd] VariousControllerObjectiveC.mm:1752
2762 -[VariousControllerController onConnect:] (in App) + 126 [0x100006eae] VariousControllerController.m:215
2762 -[TutorialWindowController variousControllerConnected] (in App) + 88 [0x100031a78] TutorialWindowController.m:93
2762 _NSPopoverCloseAndAnimate (in AppKit) + 840 [0x7fff89bac8d7]
2762 -[NSWindow orderWindow:relativeTo:] (in AppKit) + 159 [0x7fff8950ac1f]
2762 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] (in AppKit) + 668 [0x7fff8950af28]
2762 -[_NSWindowTransformAnimation startAnimation] (in AppKit) + 512 [0x7fff8936b95c]
2762 _NSWindowExchange (in AppKit) + 376 [0x7fff89a27555]
2762 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] (in AppKit) + 1377 [0x7fff8950ba18]
2762 -[NSNextStepFrame displayIfNeeded] (in AppKit) + 84 [0x7fff895d8e64]
2762 -[NSView displayIfNeeded] (in AppKit) + 1044 [0x7fff8944e981]
2762 -[NSView _sendViewWillDrawInRect:clipRootView:] (in AppKit) + 1195 [0x7fff8948240a]
2762 -[NSViewHierarchyLock lockForReadingWithExceptionHandler:] (in AppKit) + 378 [0x7fff894259e1]
2762 _pthread_cond_wait (in libsystem_c.dylib) + 869 [0x7fff8f018fe9]
2762 __psynch_cvwait (in libsystem_kernel.dylib) + 10 [0x7fff8a53d0fa]
爲什麼你很難知道究竟什麼樣的行動導致什麼錯誤消息應用程序崩潰除非問過? –
究竟是哪一行給你SIGSEGV?問題可能不是零指針,而是一個引用錯誤內存的指針。它可能指向一個已經發布的對象。 – Skotch
如何使用異常斷點來查找特定行?它只顯示發生異常的線程(我還不習慣Xcode)。 – agg23