NSWindow 和 Webview:应用程序因“无法识别的选择器发送到实例 0x100514e90”而崩溃
我在 NSWindow 中有一个 WebView,当我关闭窗口并再次打开它时,应用程序崩溃;(
该窗口由菜单项按钮调用。
这是输出:
2011-10-22 15:55:32.440 Textis[17176:903] -[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90
2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception '-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90' that raised inside Carbon event dispatch
(
0 CoreFoundation 0x00007fff838b17b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff8127af03 objc_exception_throw + 45
2 CoreFoundation 0x00007fff8390b110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
3 CoreFoundation 0x00007fff8388391f ___forwarding___ + 751
4 CoreFoundation 0x00007fff8387fa68 _CF_forwarding_prep_0 + 232
5 Textis 0x0000000100003722 -[Share tweet:] + 210
6 AppKit 0x00007fff84b3eeda -[NSApplication sendAction:to:from:] + 95
7 AppKit 0x00007fff84b6346a -[NSMenuItem _corePerformAction] + 365
8 AppKit 0x00007fff84b631d4 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 121
9 AppKit 0x00007fff84de8cf4 -[NSMenu _internalPerformActionForItemAtIndex:] + 35
10 AppKit 0x00007fff84c9a9e9 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 136
11 AppKit 0x00007fff84b4599c NSSLMMenuEventHandler + 321
12 HIToolbox 0x00007fff8665d7f7 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1002
13 HIToolbox 0x00007fff8665cd46 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 395
14 HIToolbox 0x00007fff8667aa81 SendEventToEventTarget + 45
15 HIToolbox 0x00007fff866a9c35 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 387
16 HIToolbox 0x00007fff866d6a0a SendMenuCommandWithContextAndModifiers + 56
17 HIToolbox 0x00007fff866d69c2 SendMenuItemSelectedEvent + 101
18 HIToolbox 0x00007fff866d68d2 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 150
19 HIToolbox 0x00007fff867dfa69 _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttjS4_S4_PK10__CFStringPP13OpaqueMenuRefPt + 1618
20 HIToolbox 0x00007fff867dfdc2 _HandlePopUpMenuSelection7 + 665
21 AppKit 0x00007fff84c9799b _NSSLMPopUpCarbonMenu3 + 3720
22 AppKit 0x00007fff84ec76f9 -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 162
23 AppKit 0x00007fff84bc92f5 -[NSControl mouseDown:] + 624
24 AppKit 0x00007fff84ae33a7 -[NSWindow sendEvent:] + 5409
25 AppKit 0x00007fff84ec8498 -[NSStatusBarWindow sendEvent:] + 68
26 AppKit 0x00007fff84a18afa -[NSApplication sendEvent:] + 4719
27 AppKit 0x00007fff849af6de -[NSApplication run] + 474
28 AppKit 0x00007fff849a83b0 NSApplicationMain + 364
29 Textis 0x00000001000010c2 main + 34
30 Textis 0x0000000100001094 start + 52
31 ??? 0x0000000000000001 0x0 + 1
)
I have a WebView in a NSWindow and when I close the window and open it again the app crashes ;(
The window is called by a menu item button.
Here is the output:
2011-10-22 15:55:32.440 Textis[17176:903] -[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90
2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception '-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90' that raised inside Carbon event dispatch
(
0 CoreFoundation 0x00007fff838b17b4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff8127af03 objc_exception_throw + 45
2 CoreFoundation 0x00007fff8390b110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
3 CoreFoundation 0x00007fff8388391f ___forwarding___ + 751
4 CoreFoundation 0x00007fff8387fa68 _CF_forwarding_prep_0 + 232
5 Textis 0x0000000100003722 -[Share tweet:] + 210
6 AppKit 0x00007fff84b3eeda -[NSApplication sendAction:to:from:] + 95
7 AppKit 0x00007fff84b6346a -[NSMenuItem _corePerformAction] + 365
8 AppKit 0x00007fff84b631d4 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 121
9 AppKit 0x00007fff84de8cf4 -[NSMenu _internalPerformActionForItemAtIndex:] + 35
10 AppKit 0x00007fff84c9a9e9 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 136
11 AppKit 0x00007fff84b4599c NSSLMMenuEventHandler + 321
12 HIToolbox 0x00007fff8665d7f7 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1002
13 HIToolbox 0x00007fff8665cd46 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 395
14 HIToolbox 0x00007fff8667aa81 SendEventToEventTarget + 45
15 HIToolbox 0x00007fff866a9c35 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 387
16 HIToolbox 0x00007fff866d6a0a SendMenuCommandWithContextAndModifiers + 56
17 HIToolbox 0x00007fff866d69c2 SendMenuItemSelectedEvent + 101
18 HIToolbox 0x00007fff866d68d2 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 150
19 HIToolbox 0x00007fff867dfa69 _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjPK4RecttjS4_S4_PK10__CFStringPP13OpaqueMenuRefPt + 1618
20 HIToolbox 0x00007fff867dfdc2 _HandlePopUpMenuSelection7 + 665
21 AppKit 0x00007fff84c9799b _NSSLMPopUpCarbonMenu3 + 3720
22 AppKit 0x00007fff84ec76f9 -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 162
23 AppKit 0x00007fff84bc92f5 -[NSControl mouseDown:] + 624
24 AppKit 0x00007fff84ae33a7 -[NSWindow sendEvent:] + 5409
25 AppKit 0x00007fff84ec8498 -[NSStatusBarWindow sendEvent:] + 68
26 AppKit 0x00007fff84a18afa -[NSApplication sendEvent:] + 4719
27 AppKit 0x00007fff849af6de -[NSApplication run] + 474
28 AppKit 0x00007fff849a83b0 NSApplicationMain + 364
29 Textis 0x00000001000010c2 main + 34
30 Textis 0x0000000100001094 start + 52
31 ??? 0x0000000000000001 0x0 + 1
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mainFrame
是 WebView 上的一个方法,因此
2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: 忽略异常 '-[__NSCFType mainFrame]: 无法识别的选择器发送到实例 0x100514e90 ' 在 Carbon 事件调度中引发
指向您的 WebView 被释放当窗口关闭时,操作系统显式或隐式地执行此操作。你碰到了一个死指针。
不确定您如何设置窗口,但您可能假设原始 WebView 在重新打开时仍然是有效对象。
往那个方向看一下。
mainFrame
is a method on WebViewso
2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception '-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90' that raised inside Carbon event dispatch
points to your WebView being released either by you explicitly or implicitly by the OS when the window is shut. You are hitting a dead pointer.
Not sure how you are setting up your window but you are probably assuming that the original WebView is still a valid object at a reopen.
Have a look in that direction.