rust-sciter icon indicating copy to clipboard operation
rust-sciter copied to clipboard

macOS app quits after closing first frame on sciter 5

Open Andrew-Shay opened this issue 9 months ago • 0 comments

https://sciter.com/forums/topic/macos-program-quits-after-closing-1st-frame/

On macOS, if I attempt to start a second frame, after closing the first one, the entire program quits. But on Windows, the second frame appears right after closing the first.

https://transmitic.net/sciterhelp/double-win.mp4 https://transmitic.net/sciterhelp/double-mac.mp4

https://transmitic.net/sciterhelp/test-sciter-double-win.zip https://transmitic.net/sciterhelp/test-sciter-double-mac.zip $ cargo run

Windows 10 22H2
macOS Monterey 12.6.8

sciter 71c817892a37d7e5a8976a3a3b24b0c555829e98

Rust 1.71.1
sciter-rs = "0.5.58"
libc = "0.2.147"
lazy_static = "1.4"

Quoting Andrew

For some reasons, this:

let mut frame = sciter::Window::new();

Creates sciter's window with SW_MAIN flag.

Closing main window causes [NSApp stop:nil] call. Seems like Cocoa cannot restart shared application (NSApp). Or even quits from main before that.

Solution is to start main window in hidden state, create secondary window from script and show main after secondary closure.

Andrew-Shay avatar Sep 30 '23 18:09 Andrew-Shay