larsxschneider / ShowInGitHub

Xcode plugin to open the GitHub page of the commit of the currently selected line in the editor window.
BSD 2-Clause "Simplified" License
239 stars 36 forks source link

Crash when using fullscreen window #5

Closed kemenaran closed 11 years ago

kemenaran commented 11 years ago

When the main Xcode window is in fullscreen, GitHub actions cause Xcode to crash.

It seems that -[SIGPlugin activeDocument] returns nil when the window is in fullscreen.

Xcode 4.6.2 (4H1003) Mac OS X v10.8.3

Application Specific Information:
ProductBuildVersion: 4H1003
UNCAUGHT EXCEPTION (NSInvalidArgumentException): *** setObjectForKey: object cannot be nil (key: _NSTaskDirectoryPath)
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff97799aee __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff954a93f0 objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff978285b7 -[__NSDictionaryM setObject:forKey:] (in CoreFoundation)
  3  0x00007fff929c7b18 -[NSConcreteTask setCurrentDirectoryPath:] (in Foundation)
  4  0x000000010a96415e -[SIGPlugin outputGitWithArguments:inPath:] at /Users/capitainetrain/Library/Application Support/Alcatraz/Plug-ins/ShowInGithub/Source/Classes/SIGPlugin.m:222 (in ShowInGithub)
  5  0x000000010a9642f1 -[SIGPlugin githubRepoPathForDirectory:] at /Users/capitainetrain/Library/Application Support/Alcatraz/Plug-ins/ShowInGithub/Source/Classes/SIGPlugin.m:248 (in ShowInGithub)
  6  0x000000010a964b18 -[SIGPlugin openFileOnGitHub:] at /Users/capitainetrain/Library/Application Support/Alcatraz/Plug-ins/ShowInGithub/Source/Classes/SIGPlugin.m:389 (in ShowInGithub)
  7  0x00007fff8c247989 -[NSApplication sendAction:to:from:] (in AppKit)
  8  0x0000000105ae8f60 -[DVTApplication sendAction:to:from:] (in DVTKit)
  9  0x00007fff8c37d37c -[NSMenuItem _corePerformAction] (in AppKit)
 10  0x00007fff8c37d06a -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] (in AppKit)
 11  0x00007fff8c06a28f -[NSMenu _internalPerformActionForItemAtIndex:] (in AppKit)
 12  0x00007fff8c06a117 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] (in AppKit)
 13  0x00007fff8c376175 NSSLMMenuEventHandler (in AppKit)
 14  0x00007fff92bd0d1a DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) (in HIToolbox)
 15  0x00007fff92bd01e9 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) (in HIToolbox)
 16  0x00007fff92be5fc9 SendEventToEventTarget (in HIToolbox)
 17  0x00007fff92c1cca9 SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) (in HIToolbox)
 18  0x00007fff92bc1a21 SendMenuCommandWithContextAndModifiers (in HIToolbox)
 19  0x00007fff92bc19d3 SendMenuItemSelectedEvent (in HIToolbox)
 20  0x00007fff92bc185f FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) (in HIToolbox)
 21  0x00007fff92b9d8bb MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) (in HIToolbox)
 22  0x00007fff92b9cec8 _HandleMenuSelection2 (in HIToolbox)
 23  0x00007fff8c2358f6 _NSHandleCarbonMenuEvent (in AppKit)
 24  0x00007fff8c157acf _DPSNextEvent (in AppKit)
 25  0x00007fff8c156e22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit)
 26  0x00007fff8c14e1d3 -[NSApplication run] (in AppKit)
 27  0x00007fff8c0f2c06 NSApplicationMain (in AppKit)
 28  0x00000001056b1b6f (in Xcode)
 29  0x00000001056b1b00 (in Xcode)
larsxschneider commented 11 years ago

Thanks for reporting. I just confirmed the crash. Looking into it...

larsxschneider commented 11 years ago

@kemenaran I think I fixed it here: https://github.com/larsxschneider/ShowInGitHub/commit/51072fea5b744bb1cf81ff4e4e6b5819336562ed

Can you give it a try? (if you use Alcatraz it should update automatically)

kemenaran commented 11 years ago

I can't reproduce the crash with the latest version. Thanks!