diff --git a/src/platform/macos/window.rs b/src/platform/macos/window.rs index d9959fb9..ccc178eb 100644 --- a/src/platform/macos/window.rs +++ b/src/platform/macos/window.rs @@ -197,6 +197,10 @@ impl Window { pl_attribs: &PlatformSpecificWindowBuilderAttributes) -> Result { + 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"))); },