HsiangHo/XUIKit

调用NSOpenPanel会崩溃

Closed this issue · 3 comments

调用NSOpenPanel会崩溃

@dd2333 请问一下您的具体环境,SDK和当前的macOS系统,我这边可以测试一下。 我自己用的10.12 的SDK和macOS 10.14,暂时没有发现问题。 :)

SDK是10.14的,mac os是10.14.5的,使用和堆栈如下,我

NSOpenPanel *panel = [NSOpenPanel openPanel];
panel.allowsMultipleSelection = NO;
panel.canCreateDirectories = YES;
panel.canChooseDirectories = YES;
panel.canChooseFiles = NO;
panel.directoryURL = [NSURL URLWithString:NSHomeDirectory()];

if ([panel runModal] == NSModalResponseOK) {
    [self.pathView setText:panel.URL.path];
}

2019-06-10 19:53:26.846023+0800 xxx[66168:2094226] -[FI_TColumnViewController xui_mouseMoved:]: unrecognized selector sent to instance 0x1029d4a00
2019-06-10 19:53:26.870879+0800 xxx[66168:2094226] [General] -[FI_TColumnViewController xui_mouseMoved:]: unrecognized selector sent to instance 0x1029d4a00
2019-06-10 19:53:26.874818+0800 xxx[66168:2094226] [General] (
0 CoreFoundation 0x00007fff4eb59cfd __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff79203a17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4ebd3b06 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff4eafbb8f forwarding + 1485
4 CoreFoundation 0x00007fff4eafb538 _CF_forwarding_prep_0 + 120
5 AppKit 0x00007fff4c359233 forwardMethod + 211

7   AppKit                              0x00007fff4c359233 forwardMethod + 211
8   AppKit                              0x00007fff4c359233 forwardMethod + 211
9   AppKit                              0x00007fff4c359233 forwardMethod + 211
10  AppKit                              0x00007fff4c359233 forwardMethod + 211
11  AppKit                              0x00007fff4c359233 forwardMethod + 211
12  AppKit                              0x00007fff4c359233 forwardMethod + 211

14  AppKit                              0x00007fff4c359233 forwardMethod + 211

16  AppKit                              0x00007fff4c35c128 -[NSTrackingArea mouseMoved:] + 151
17  AppKit                              0x00007fff4c294d25 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 4726
18  AppKit                              0x00007fff4c293867 -[NSWindow(NSEventRouting) sendEvent:] + 478
19  AppKit                              0x00007fff4c133b98 -[NSApplication(NSEvent) sendEvent:] + 3220
20  AppKit                              0x00007fff4c36df06 -[NSApplication _doModalLoop:peek:] + 450
21  AppKit                              0x00007fff4c36c95a __35-[NSApplication runModalForWindow:]_block_invoke_2 + 64
22  AppKit                              0x00007fff4c36c907 __35-[NSApplication runModalForWindow:]_block_invoke + 70
23  AppKit                              0x00007fff4c36c171 _NSTryRunModal + 100
24  AppKit                              0x00007fff4c36c056 -[NSApplication runModalForWindow:] + 128
25  AppKit                              0x00007fff4c88975f -[NSSavePanel runModal] + 476

27  AppKit                              0x00007fff4c41a844 -[NSApplication(NSResponder) sendAction:to:from:] + 312
28  AppKit                              0x00007fff4c41a55c _NSGestureRecognizerSendActions + 204
29  AppKit                              0x00007fff4c419cf8 -[NSGestureRecognizer _updateGestureWithEvent:] + 867
30  AppKit                              0x00007fff4c41997a -[NSGestureRecognizer _delayedUpdateGesture] + 60
31  AppKit                              0x00007fff4c419926 ___NSGestureRecognizerUpdate_block_invoke + 51
32  AppKit                              0x00007fff4c297796 _NSGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 282
33  AppKit                              0x00007fff4c296f8c _NSGestureRecognizerUpdate + 1450
34  AppKit                              0x00007fff4c35ab44 -[NSWindow(NSGestureRecognizer_Routing) _sendEventToGestureRecognizers:requireAcceptsFirstMouse:] + 3016
35  AppKit                              0x00007fff4c29384a -[NSWindow(NSEventRouting) sendEvent:] + 449
36  AppKit                              0x00007fff4c13304f -[NSApplication(NSEvent) sendEvent:] + 331
37  AppKit                              0x00007fff4c121874 -[NSApplication run] + 755
38  AppKit                              0x00007fff4c110d7c NSApplicationMain + 777

40  libdyld.dylib                       0x00007fff7a9d13d5 start + 1

)

@dd2333 通过使用RSSwizzle解决了崩溃的问题,详情请看PR,你可以再bug-fix分支进行调试。