Commit a567b01 1 parent 5237850 commit a567b01 Copy full SHA for a567b01
File tree 1 file changed +16
-7
lines changed
1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -52,13 +52,22 @@ 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
+ else
68
+ // The app is running in CLI mode, then we just call finishLaunching.
69
+ [m_app finishLaunching ];
70
+ }
62
71
63
72
[m_appDelegate resetCliFiles ];
64
73
}
You can’t perform that action at this time.
0 commit comments