Stop calling NSApplication.finishLaunching on window creation (#1902)

This is called internally by NSApplication.run, and is not something we should call - I couldn't find the reasoning behind this being there in the first place, git blame reveals c38110cac from 2014, so probably a piece of legacy code.

Removing this fixes creating new windows when you have assigned a main menu to the application.
This commit is contained in:
Mads Marquart 2021-04-07 22:24:49 +02:00 committed by GitHub
parent ba704c4eb4
commit 629cd86c7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -1,5 +1,6 @@
# Unreleased
- On macOS, fix creating new windows when the application has a main menu.
- On Windows, fix fractional deltas for mouse wheel device events.
- On macOS, fix segmentation fault after dropping the main window.
- On Android, `InputEvent::KeyEvent` is partially implemented providing the key scancode.

View file

@ -100,13 +100,13 @@ fn create_app(activation_policy: ActivationPolicy) -> Option<id> {
if ns_app == nil {
None
} else {
// TODO: Move ActivationPolicy from an attribute on the window to something on the EventLoop
use self::NSApplicationActivationPolicy::*;
ns_app.setActivationPolicy_(match activation_policy {
ActivationPolicy::Regular => NSApplicationActivationPolicyRegular,
ActivationPolicy::Accessory => NSApplicationActivationPolicyAccessory,
ActivationPolicy::Prohibited => NSApplicationActivationPolicyProhibited,
});
ns_app.finishLaunching();
Some(ns_app)
}
}
@ -357,6 +357,7 @@ impl UnownedWindow {
panic!("Windows can only be created on the main thread on macOS");
}
}
trace!("Creating new window");
let pool = unsafe { NSAutoreleasePool::new(nil) };