Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV when a sleep isn't done after a dispatch #15

Closed
L-as opened this issue Feb 17, 2018 · 2 comments
Closed

SIGSEGV when a sleep isn't done after a dispatch #15

L-as opened this issue Feb 17, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@L-as
Copy link

L-as commented Feb 17, 2018

The following code crashes:

#![allow(unused_imports)]

use std::thread::{spawn, sleep};
use std::time::Duration;
use urlencoding;
use web_view as webview;

pub fn main() {
	let size      = (800, 600);
	let resizable = true;
	let debug     = true;
	let url       = "data:text/html,".to_string() + &urlencoding::encode(HTML);
	webview::run("timer example", &url, Some(size), resizable, debug, move |webview| {
		spawn(move || {
			webview.dispatch(|_webview, _userdata| {});
			//sleep(Duration::from_millis(100));
		});
	}, move |_webview, _arg, _userdata| {
	}, ());
}

const HTML: &'static str = r#"
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>laspad</title>
	</head>
	<body>
	</body>
</html>
"#;

If you uncomment the sleep, it runs successfully.

@Boscop Boscop added the bug Something isn't working label Feb 22, 2018
@Boscop
Copy link
Owner

Boscop commented Feb 22, 2018

Hm, weird..
Any idea why?

It must be caused by the thread exiting before the dispatched closure gets called. But the closure should be callable independently of the thread, right?

@L-as
Copy link
Author

L-as commented Feb 22, 2018

I honestly have no idea, and it seems to only happen on one of my machines (I think). Does it happen on yours too?

Also, I'm using the latest linux kernel on arch linux with nightly rust (last updated a few days ago).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants