Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.3.0 crashed and can no longer be started #202

Closed
mrc247-DE opened this issue Apr 2, 2020 · 23 comments
Closed

v3.3.0 crashed and can no longer be started #202

mrc247-DE opened this issue Apr 2, 2020 · 23 comments
Labels
bug Something isn't working

Comments

@mrc247-DE
Copy link

I update to 3.3.0
Open Settings
App Crashed
I can not start it anymore
I reboot my Mac
I reinstall 3.3.0

but 3.3.0 alway crash and I can not start it anymore :-(

@lwouis lwouis added the bug Something isn't working label Apr 2, 2020
@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

Oh that's terrible! Another user had a similar issue #125 (comment)

If it crashes straight away, I think it may be an issue with reading the preferences. Could you run this command and share the results?

defaults read com.lwouis.alt-tab-macos

Or any crash report or Console.app logs of course would help!

@mrc247-DE
Copy link
Author

sorry I delete the app with all files and logs and install 3.2.1 again.

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

No need to downgrade. If it crashes when 3.3.0 is starting, I would like to see what the command I gave above shows, because my first guess would be a preference incompatibility.

@janbl
Copy link

janbl commented Apr 2, 2020

I have deleted the preferences. Still same crash.
defaults delete com.lwouis.alt-tab-macos

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

@janbl showed his preferences:

defaults read com.lwouis.alt-tab-macos
{
    "NSWindow Frame SUUpdateAlert" = "1410 557 700 622 0 0 3440 1417 ";
    SUHasLaunchedBefore = 1;
    SULastCheckTime = "2020-04-02 11:17:23 +0000";
    SUUpdateRelaunchingMarker = 1;
    alignThumbnails = Center;
    metaKey = "\\U2318 command";
    startAtLogin = true;
    tabKeyCode = 48;
    theme = "\\Uf8ff macOS";
    windowDisplayDelay = 0;
}

I replicated exactly that on 3.2.1, then started 3.3.0, and nothing crashes. Not sure how to proceed then

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

I guess it's crashing for another reason. I can't reproduce locally. Do you see any logs in Console.app?

@janbl
Copy link

janbl commented Apr 2, 2020

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [93589]

Application Specific Information:
Performing @selector(callClosureWithSender:) from sender NSButton 0x7fa24bd86910

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.lwouis.alt-tab-macos 0x000000010695353d specialized static GeneralTab.startAtLoginCallback(:) + 957
1 com.lwouis.alt-tab-macos 0x000000010694964c partial apply for closure #1 in static LabelAndControl.setupControl(
:::) + 44
2 com.lwouis.alt-tab-macos 0x000000010694ab4f thunk for @escaping @callee_guaranteed (@guaranteed NSControl) -> () + 15
3 com.lwouis.alt-tab-macos 0x000000010691f2cc SelectorWrapper.callClosure(sender:) + 124
4 com.lwouis.alt-tab-macos 0x000000010691f312 @objc SelectorWrapper.callClosure(sender:) + 34
5 com.apple.AppKit 0x00007fff343df437 -[NSApplication(NSResponder) sendAction:to:from:] + 299
6 com.apple.AppKit 0x00007fff343df2d2 -[NSControl sendAction:to:] + 86
7 com.lwouis.alt-tab-macos 0x00000001069492f5 specialized static LabelAndControl.makeLabelWithCheckbox(::extraAction:labelPosition:) + 1381
8 com.lwouis.alt-tab-macos 0x000000010694da9a static GeneralTab.makeView() + 202
9 com.lwouis.alt-tab-macos 0x000000010694d7d1 static GeneralTab.make() + 177
10 com.lwouis.alt-tab-macos 0x00000001069479d6 PreferencesWindow.setupTabViews() + 86
11 com.lwouis.alt-tab-macos 0x0000000106947963 @objc PreferencesWindow.init() + 227
12 com.lwouis.alt-tab-macos 0x000000010693e752 App.applicationDidFinishLaunching(:) + 1298
13 com.lwouis.alt-tab-macos 0x000000010693e9eb @objc App.applicationDidFinishLaunching(
:) + 107
14 com.apple.CoreFoundation 0x00007fff36f159cf CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12
15 com.apple.CoreFoundation 0x00007fff36f15963 ___CFXRegistrationPost1_block_invoke + 63
16 com.apple.CoreFoundation 0x00007fff36f158d8 _CFXRegistrationPost1 + 372
17 com.apple.CoreFoundation 0x00007fff36f15544 ___CFXNotificationPost_block_invoke + 80
18 com.apple.CoreFoundation 0x00007fff36ee56bd -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1554
19 com.apple.CoreFoundation 0x00007fff36ee4b69 _CFXNotificationPost + 1351
20 com.apple.Foundation 0x00007fff3955b866 -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
21 com.apple.AppKit 0x00007fff341a6153 -[NSApplication _postDidFinishNotification] + 312
22 com.apple.AppKit 0x00007fff341a5e92 -[NSApplication _sendFinishLaunchingNotification] + 208
23 com.apple.AppKit 0x00007fff341a2f53 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 549
24 com.apple.AppKit 0x00007fff341a2b98 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 688
25 com.apple.Foundation 0x00007fff39586b06 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308
26 com.apple.Foundation 0x00007fff39586970 _NSAppleEventManagerGenericHandler + 98
27 com.apple.AE 0x00007fff38292203 0x7fff38285000 + 53763
28 com.apple.AE 0x00007fff38291929 0x7fff38285000 + 51497
29 com.apple.AE 0x00007fff38289bd7 aeProcessAppleEvent + 449
30 com.apple.HIToolbox 0x00007fff35b637fa AEProcessAppleEvent + 54
31 com.apple.AppKit 0x00007fff3419cf31 _DPSNextEvent + 1547
32 com.apple.AppKit 0x00007fff3419b4e0 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
33 com.apple.AppKit 0x00007fff3418d1ee -[NSApplication run] + 658
34 com.lwouis.alt-tab-macos 0x000000010691997e main + 62
35 libdyld.dylib 0x00007fff70e67cc9 start + 1

@zoomosis
Copy link

zoomosis commented Apr 2, 2020

Same issue here on OS X 10.14.6.

$ defaults read com.lwouis.alt-tab-macos

{
SUAutomaticallyUpdate = 0;
SUEnableAutomaticChecks = 0;
SUHasLaunchedBefore = 1;
SULastCheckTime = "2020-03-11 16:44:02 +0000";
metaKey = "\U2318 command";
startAtLogin = true;
tabKeyCode = 48;
theme = "\Uf8ff macOS";
}

$ cd /Applications/AltTab.app/Contents/MacOS

$ ./AltTab
"currentSpaceId" 1
"Current space" 1
"Adding app" 15856 "com.apple.loginwindow"
"Adding app" 15912 "com.apple.systemuiserver"
"Adding app" 15911 "com.apple.dock"
"Adding app" 15910 "com.apple.talagent"
"Adding app" 15913 "com.apple.finder"
"Adding app" 15945 "com.apple.notificationcenterui"
"Adding app" 15960 "com.apple.dock.extra"
"Adding app" 15963 "com.apple.CoreLocationAgent"
"Adding app" 15980 "com.apple.Spotlight"
"Adding app" 15982 "com.shauninman.Day-O"
"Adding app" 16008 "com.apple.AirPlayUIAgent"
"Adding app" 16019 "com.apple.locationmenu"
"Adding app" 16038 "com.apple.coreservices.uiagent"
"Adding app" 16013 "com.apple.nbagent"
"Adding app" 15961 "com.apple.wifi.WiFiAgent"
"Adding app" 16063 "com.apple.cloudphotosd"
"Adding app" 16076 "com.brave.Browser"
"Adding app" 16158 "com.googlecode.iterm2"
"Adding app" 16189 "com.lwouis.alt-tab-macos"
"Adding window" 88 "Applications" "com.apple.finder" 1 1
"Adding window" 81 "(2) v3.3.0 crashed and can no longer be started · Issue #202 · lwouis/alt-tab-macos - Brave" "com.brave.Browser" 1 1
"Adding window" 105 "Default (zsh)" "com.googlecode.iterm2" 1 1
zsh: illegal hardware instruction ./AltTab

@ghost
Copy link

ghost commented Apr 2, 2020

@lwouis As requested in #200, I have checked on my system and have no issues. Running 10.15.4, I have restarted and even changed preferences in Alt-tab but have not had any crashes.

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

Hard to tell what's wrong here. I'm trying a blind fix with #203

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

@janbl @zoomosis @mrc247-DE what macOS version are you running on?

@janbl
Copy link

janbl commented Apr 2, 2020

OS Version: Mac OS X 10.15.4 (19E266)

@ghost
Copy link

ghost commented Apr 2, 2020

@zoomosis mentioned earlier s/he was on 10.14.6

Same issue here on OS X 10.14.6.

@mrc247-DE
Copy link
Author

macOS Catalina 10.15.4

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

Can you guys open the project in XCode perhaps? It's only 3 steps to run the app locally. When you run the app in debug mode and it crashes, it shows you the line and you can understand what's happening way easier since you have the line, the variables on the stack, etc.

In any case, I'm going to merge the blind fixes in #203 as soon as the PR build passes. Maybe that will help

lwouis pushed a commit that referenced this issue Apr 2, 2020
## [3.3.1](v3.3.0...v3.3.1) (2020-04-02)

### Bug Fixes

* blind fix trying to guess root cause of [#202](#202) ([fb4fe11](fb4fe11))
* checkboxes preferences were unchecked initially ([b091282](b091282))
@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

I just released v3.3.1. Can you guys try it and share if it fixes the issue for you? 🤞

@zoomosis
Copy link

zoomosis commented Apr 2, 2020

3.3.1 seems OK here under OS X 10.14.6. No crash on launch. Thanks!

@janbl
Copy link

janbl commented Apr 2, 2020

3.3.1. Looks a lot better.
I still face a crash if i click on the start at login checkbox (only that)!

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

I still face a crash if i click on the start at login checkbox (only that)!

Oh that's really interesting! Thanks for testing and finding this!

Are you checking or unchecking the checkbox?

The issue means something in this function throws an exception:

https://github.com/lwouis/alt-tab-macos/blob/master/src/ui/preferences-window/tabs/GeneralTab.swift#L106

It is quite puzzling since this code hasn't changed much. I wonder if it's something specific to your environment like not enough permissions to delete a login item or something.

Could you please share your login items? Here are mine for instance:

image

Another potential lead: do you have AltTab in your /Applications folder? What path exactly is AltTab at?

@janbl
Copy link

janbl commented Apr 2, 2020

Your guess is right, I had an entry with an exclamation mark from an already deleted app in my login items. After deleting the entry your dialog works well. I tried to reproduce the weird entry but was not able to.

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

@janbl I was able to identify the root cause thank to your help!

Goddamn Apple strikes again:

LSSharedFileListItemCopyResolvedURL can return nil.

The signature is

public func LSSharedFileListItemCopyResolvedURL(_ inItem: LSSharedFileListItem!, _ inFlags: LSSharedFileListResolutionFlags, _ outError: UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Unmanaged<CFURL>!

They forced the result with ! for some reason, so using it in Swift without checking for nullity compiles! But then at runtime it can be nil thus crashing the app. It happens when you have an app in your login items that was removed. It is still listed but the link to the app is broken since the app is no longer in that location.

I'll make a fix for this as soon as possible! 👍

@janbl
Copy link

janbl commented Apr 2, 2020

Very cool, thanks for the really quick fix.
And thanks for the mouse move feature, I really appreciate that.

@lwouis
Copy link
Owner

lwouis commented Apr 2, 2020

Another technical note to document this mess from Apple:

Calling LSSharedFileListItemRemove on a login item with the yellow warning triangle returns -50 and doesn't work. There is thus no programmatic way to clean invalid login items for the user. They have to manually click the minus button.

So for AltTab I fixed the crash when going through the items and finding one without URL, but I still can't clean old invalid items.

@lwouis lwouis closed this as completed in 48d5d63 Apr 2, 2020
lwouis pushed a commit that referenced this issue Apr 2, 2020
## [3.3.2](v3.3.1...v3.3.2) (2020-04-02)

### Bug Fixes

* crashed if an invalid login item existed (closes [#202](#202)) ([48d5d63](48d5d63))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants