sciter-sdk / rust-sciter

Rust bindings for Sciter
https://sciter.com
MIT License
805 stars 75 forks source link

I can't connect to the inspector anymore #61

Closed DevJac closed 4 years ago

DevJac commented 5 years ago

I recently updated my sciter-sdk and I am unable to connect to the inspector. My code is unchanged. I was previously able to connect to the inspector and now I am not able to. Unfortunately, I didn't take note of what version of the SDK I had previously, but it was a few months old I think. EDIT: I should add that I am using Sciter version 4.2.7.5 on Linux-5.0.5-200.fc29.x86_64

rudedogg commented 5 years ago

I downloaded the Sciter SKD and rust-sciter a short while ago, and am also unable to load the inspector using the minimal example. I'm running macOS 10.14.4.

When I click the inspector.app nothing loads, but executing /sciter-sdk-2/bin.osx/inspector.app/Contents/MacOS/inspector from the command line loads the window.

However I can't connect to anything once it is loaded. Apologies if this is a sciter-sdk issue, but this looked related so I thought I'd comment.

pravic commented 5 years ago

See #46

rudedogg commented 5 years ago

@pravic Thanks, adding the line from #52 fixed connecting to the inspector.

DevJac commented 5 years ago
pub fn app_main(db_conn: &mut Connection) {
    setup_sciter();
    let app_archive = sciter::host::Archive::open(APP_ARCHIVE).unwrap();
    let mut main_window = sciter::Window::new();
    main_window.sciter_handler(HostHandler { app_archive });
    main_window.event_handler(EventHandler { db_conn });
    main_window.load_file("main.htm");
    main_window.run_app();
}

fn setup_sciter() {
    sciter::set_options(sciter::RuntimeOptions::DebugMode(true)).unwrap();
    sciter::set_options(sciter::RuntimeOptions::ScriptFeatures(
        sciter::SCRIPT_RUNTIME_FEATURES::ALLOW_SOCKET_IO as u8,
    ))
    .unwrap();
}

I have the above in my code and I am still unable to connect to the inspector. Again, I was able to connect before updating and now I am not able to. The only thing that changed is the version of the Sciter SDK I had installed; my own code did not change and the rust-sciter (aka sciter-rs) version was not changed. This strongly suggests the problem is in the SDK, but it's hard for me to confirm since the SDK is closed source and written in C++ which I'm less familiar with.

rudedogg commented 5 years ago

@DevJac Does it need to be set on the window?

Like:

main_window.set_options(sciter::window::Options::DebugMode(true)).unwrap();

I tried setting it globally like your code and it stopped working, so I think that may be the issue.

I've just started toying with Rust so I'm not sure why, and the docs don't seem to mention anything other than you need to set the option before loading HTML. Maybe it's a bug?

DevJac commented 5 years ago

That's a good possibility. I will check it out ASAP. Right now my inspector is segfaulting with the latest Sciter version though.

DevJac commented 5 years ago

I tried on Windows and I can connect to the inspector on Windows. So, to recap: I could connect to the inspector on Linux around the 4.2.6 version of the Sciter SDK. Then I updated to the a more recent SDK and could not connect to the inspector. Then I tried Windows (with the latest 4.2.8.2 SDK) and I could connect to the inspector.

Again, it seems this is a problem with the SDK itself.

DevJac commented 5 years ago

I updated to the latest SDK, version 4.2.8.3. I am able to connect to the inspector again on Linux / GTK. I have not made any code changes during this time, so the changes in behavior must have been within Sciter itself.

This ticket can be closed I think, the reason I created it has been resolved.

Just to clarify, the trouble I was having were always on Linux. I could connect on Linux, then I couldn't, and now I can again. I never had any troubles with Windows. It was the same Rust codebase the whole time on both platforms.

pravic commented 4 years ago

Okay, closing.