Closed robin closed 11 years ago
Using this workaround seems to make it throw an exception:
2012-12-16 13:23:14.375 SampleApp[10439:707] *** Assertion failure in -[INAppStoreWindowDelegateProxy methodSignatureForSelector:], /Users/indragie/Desktop/INAppStoreWindow/SampleApp/SampleApp/../../INAppStoreWindow.m:119
2012-12-16 13:23:14.376 SampleApp[10439:707] An uncaught exception was raised
2012-12-16 13:23:14.376 SampleApp[10439:707] The method signature(isKindOfClass:) should not be nil becuase of the respondsToSelector: check
2012-12-16 13:23:14.381 SampleApp[10439:707] (
0 CoreFoundation 0x00007fff8670b0a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff91bb43f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8670aee8 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff9131e6a2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 SampleApp 0x00000001000022a9 -[INAppStoreWindowDelegateProxy methodSignatureForSelector:] + 265
5 CoreFoundation 0x00007fff866f9560 ___forwarding___ + 304
6 CoreFoundation 0x00007fff866f93b8 _CF_forwarding_prep_0 + 232
7 Foundation 0x00007fff913ca3da -[NSProxy isKindOfClass:] + 61
8 AppKit 0x00007fff890449e8 -[NSWindow validRequestorForSendType:returnType:] + 79
9 AppKit 0x00007fff8906b126 +[NSServicesMenuHandler _requestorStartingWithChain:forProposedSendTypes:proposedReturnTypes:sendTypes:returnTypes:] + 2651
10 AppKit 0x00007fff8906b5d4 _NSFindRequestor + 47
11 AppKit 0x00007fff89150cfb -[_NSMenuContext filterEntriesWithRequestorBySupportedSendAndReceiveTypes:returningSendTypesIntoArray:returningEntriesNeedingURLTypecheckingIntoSet:] + 300
12 AppKit 0x00007fff89151dc9 -[_NSMenuContext _preconcurrentPortionOfQualifyEntries:returningEntriesNeedingURLTypecheckingIntoSet:] + 109
13 AppKit 0x00007fff891525d0 -[_NSMenuContext qualifyEntries:withCompletionHandler:] + 267
14 AppKit 0x00007fff8906fabd -[_NSServicesPrincipalMenuUpdater updateVisibilityOfServicesItemsForMenu:isForDisplay:] + 324
15 AppKit 0x00007fff88c916a6 -[_NSServicesMenuUpdater insertServicesIntoMenu:withKeyEvent:isForDisplay:] + 744
16 AppKit 0x00007fff88c91369 -[_NSServicesMenuUpdater updateMenu:withEvent:withFlags:] + 92
17 AppKit 0x00007fff88c912f5 -[_NSServicesPrincipalMenuUpdater updateMenu:withEvent:withFlags:] + 129
18 AppKit 0x00007fff88c904cb -[NSMenu _populateFromDelegateWithEventRef:] + 197
19 AppKit 0x00007fff88c34e64 -[NSMenu _populateWithEventRef:] + 83
20 AppKit 0x00007fff88c8f6ac -[NSCarbonMenuImpl _carbonPopulateEvent:handlerCallRef:] + 427
21 AppKit 0x00007fff88c8f245 NSSLMMenuEventHandler + 342
22 HIToolbox 0x00007fff8637ff0a _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1206
23 HIToolbox 0x00007fff8637f3d9 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 410
24 HIToolbox 0x00007fff8637f236 SendEventToEventTargetWithOptions + 43
25 HIToolbox 0x00007fff863c8d58 _Z16SendMenuPopulateP8MenuDataP20OpaqueEventTargetRefjdjP14OpaqueEventRefPh + 279
26 HIToolbox 0x00007fff86351d5a _ZL15SendMenuOpeningP14MenuSelectDataP8MenuDatadjjP14__CFDictionaryhPh + 286
27 HIToolbox 0x00007fff863518ba _ZL11DrawTheMenuP14MenuSelectDataPP9__CFArrayhPh + 195
28 HIToolbox 0x00007fff864e7b7d _Z11OpenSubmenuP14MenuSelectDataP8MenuDatahPh + 226
29 HIToolbox 0x00007fff86350f76 _ZL15TrackMenuCommonR14MenuSelectDataPh + 1567
30 HIToolbox 0x00007fff8634c9f6 _ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt + 424
31 HIToolbox 0x00007fff8634c0b8 _HandleMenuSelection2 + 565
32 AppKit 0x00007fff88b4e9c6 _NSHandleCarbonMenuEvent + 245
33 AppKit 0x00007fff88a70b7f _DPSNextEvent + 2073
34 AppKit 0x00007fff88a6fed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
35 AppKit 0x00007fff88a67283 -[NSApplication run] + 517
36 AppKit 0x00007fff88a0bcb6 NSApplicationMain + 869
37 SampleApp 0x00000001000013f2 main + 34
38 SampleApp 0x00000001000013c4 start + 52
39 ??? 0x0000000000000003 0x0 + 3
)
2012-12-16 13:23:14.925 SampleApp[10439:707] *** Assertion failure in -[INAppStoreWindowDelegateProxy methodSignatureForSelector:], /Users/indragie/Desktop/INAppStoreWindow/SampleApp/SampleApp/../../INAppStoreWindow.m:119
2012-12-16 13:23:14.931 SampleApp[10439:707] The method signature(isKindOfClass:) should not be nil becuase of the respondsToSelector: check
2012-12-16 13:23:14.933 SampleApp[10439:707] (
0 CoreFoundation 0x00007fff8670b0a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff91bb43f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8670aee8 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff9131e6a2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 SampleApp 0x00000001000022a9 -[INAppStoreWindowDelegateProxy methodSignatureForSelector:] + 265
5 CoreFoundation 0x00007fff866f9560 ___forwarding___ + 304
6 CoreFoundation 0x00007fff866f93b8 _CF_forwarding_prep_0 + 232
7 Foundation 0x00007fff913ca3da -[NSProxy isKindOfClass:] + 61
8 AppKit 0x00007fff890449e8 -[NSWindow validRequestorForSendType:returnType:] + 79
9 AppKit 0x00007fff8906b126 +[NSServicesMenuHandler _requestorStartingWithChain:forProposedSendTypes:proposedReturnTypes:sendTypes:returnTypes:] + 2651
10 AppKit 0x00007fff8906b5d4 _NSFindRequestor + 47
11 AppKit 0x00007fff89150cfb -[_NSMenuContext filterEntriesWithRequestorBySupportedSendAndReceiveTypes:returningSendTypesIntoArray:returningEntriesNeedingURLTypecheckingIntoSet:] + 300
12 AppKit 0x00007fff89151dc9 -[_NSMenuContext _preconcurrentPortionOfQualifyEntries:returningEntriesNeedingURLTypecheckingIntoSet:] + 109
13 AppKit 0x00007fff891525d0 -[_NSMenuContext qualifyEntries:withCompletionHandler:] + 267
14 AppKit 0x00007fff8906fabd -[_NSServicesPrincipalMenuUpdater updateVisibilityOfServicesItemsForMenu:isForDisplay:] + 324
15 AppKit 0x00007fff88c916a6 -[_NSServicesMenuUpdater insertServicesIntoMenu:withKeyEvent:isForDisplay:] + 744
16 AppKit 0x00007fff8906f35a -[_NSServicesMenuUpdater updateForLiveServicesChangedNotification:] + 175
17 CoreFoundation 0x00007fff866bd47a _CFXNotificationPost + 2554
18 Foundation 0x00007fff9135a846 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
19 AppKit 0x00007fff88c1b748 performServicesLiveMenuUpdate + 94
20 CoreFoundation 0x00007fff866c8272 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 18
21 CoreFoundation 0x00007fff86688a4f __CFRunLoopDoBlocks + 255
22 CoreFoundation 0x00007fff866ad220 __CFRunLoopRun + 1904
23 CoreFoundation 0x00007fff866ac6b2 CFRunLoopRunSpecific + 290
24 HIToolbox 0x00007fff863a70a4 RunCurrentEventLoopInMode + 209
25 HIToolbox 0x00007fff863a6e42 ReceiveNextEventCommon + 356
26 HIToolbox 0x00007fff86367234 _ZL19IsUserStillTrackingP14MenuSelectDataPh + 194
27 HIToolbox 0x00007fff864e9fb0 _ZL13CheckDraggingP14MenuSelectDataPh + 314
28 HIToolbox 0x00007fff86350f9c _ZL15TrackMenuCommonR14MenuSelectDataPh + 1605
29 HIToolbox 0x00007fff8634c9f6 _ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt + 424
30 HIToolbox 0x00007fff8634c0b8 _HandleMenuSelection2 + 565
31 AppKit 0x00007fff88b4e9c6 _NSHandleCarbonMenuEvent + 245
32 AppKit 0x00007fff88a70b7f _DPSNextEvent + 2073
33 AppKit 0x00007fff88a6fed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
34 AppKit 0x00007fff88a67283 -[NSApplication run] + 517
35 AppKit 0x00007fff88a0bcb6 NSApplicationMain + 869
36 SampleApp 0x00000001000013f2 main + 34
37 SampleApp 0x00000001000013c4 start + 52
38 ??? 0x0000000000000003 0x0 + 3
)
My situation is, if you do not use the work around, the exact same exception will be thrown. If the work around is used, by which I implement the isKindOfClass in the proxy, the exception won't be thrown.
Calling [NSMenu popUpContextMenu: withEvent: forView:]; crashes the application in - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector of INAppStoreWindowDelegateProxy when no secondary NSWindowDelegate is defined. It also crashes if I associates a menu to a view as context menu and right-click on the view.
I added a popup menu to the sample app to verify the bug. Right click on the main view to popup the context menu.