mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Panic if the user attempts to create window on non-main thread
This commit is contained in:
parent
b62ecfd517
commit
926e03039f
|
@ -197,6 +197,10 @@ impl Window {
|
||||||
pl_attribs: &PlatformSpecificWindowBuilderAttributes)
|
pl_attribs: &PlatformSpecificWindowBuilderAttributes)
|
||||||
-> Result<Window, CreationError>
|
-> Result<Window, CreationError>
|
||||||
{
|
{
|
||||||
|
if !msg_send![cocoa::base::class("NSThread"), isMainThread] {
|
||||||
|
panic!("Windows can only be created on the main thread on macOS");
|
||||||
|
}
|
||||||
|
|
||||||
let app = match Window::create_app(pl_attribs.activation_policy) {
|
let app = match Window::create_app(pl_attribs.activation_policy) {
|
||||||
Some(app) => app,
|
Some(app) => app,
|
||||||
None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
|
None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
|
||||||
|
|
Loading…
Reference in a new issue