Commit 8099a17 1 parent 5237850 commit 8099a17 Copy full SHA for 8099a17
File tree 1 file changed +18
-7
lines changed
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -52,13 +52,24 @@ void setAppMode(AppMode appMode)
52
52
53
53
void finishLaunching ()
54
54
{
55
- // [m_app run] can only be called once.
56
- if (![[NSRunningApplication currentApplication ] isFinishedLaunching ])
57
- // Note that the [m_app run] call doesn't block because we are calling
58
- // [NSApp stop] from [AppDelegateOSX applicationDidFinishLaunching]. We only
59
- // need the application's initialization done inside run to prevent issues
60
- // such as: https://github.com/aseprite/aseprite/issues/4795
61
- [m_app run ];
55
+ id runningApp = [NSRunningApplication currentApplication ];
56
+ // [m_app run] must be called once, if the app didn't finish launching yet.
57
+ if (![runningApp isFinishedLaunching ]) {
58
+ // The run method must be called in GUI mode only, otherwise the
59
+ // [AppDelegateOSX applicationDidFinishLaunching] doesn't get called
60
+ // and [m_app run] ends up blocking the app.
61
+ if ([runningApp activationPolicy ] == NSApplicationActivationPolicyRegular) {
62
+ // Note that the [m_app run] call doesn't block because we are calling
63
+ // [NSApp stop] from [AppDelegateOSX applicationDidFinishLaunching]. We only
64
+ // need the application's initialization done inside run to prevent issues
65
+ // such as: https://github.com/aseprite/aseprite/issues/4795
66
+ [m_app run ];
67
+ }
68
+ else {
69
+ // The app is running in CLI mode, then we just call finishLaunching.
70
+ [m_app finishLaunching ];
71
+ }
72
+ }
62
73
63
74
[m_appDelegate resetCliFiles ];
64
75
}
You can’t perform that action at this time.
0 commit comments