Panic if the user attempts to create window on non-main thread
This commit is contained in:
parent
b62ecfd517
commit
926e03039f
1 changed files with 4 additions and 0 deletions
|
|
@ -197,6 +197,10 @@ impl Window {
|
|||
pl_attribs: &PlatformSpecificWindowBuilderAttributes)
|
||||
-> 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) {
|
||||
Some(app) => app,
|
||||
None => { return Err(OsError(format!("Couldn't create NSApplication"))); },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue