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

Mysterious crash when pen size is less than 2.0 #202

Closed
Kixunil opened this issue Sep 20, 2020 · 3 comments
Closed

Mysterious crash when pen size is less than 2.0 #202

Kixunil opened this issue Sep 20, 2020 · 3 comments

Comments

@Kixunil
Copy link

Kixunil commented Sep 20, 2020

This code:

fn fractal(turtle: &mut turtle::Turtle, distance: f64, angles: u32, depth: u32) {
    for _ in 0..angles {
        turtle.forward(distance);
        if depth > 0 {
            fractal(turtle, distance / 2.0, angles, depth - 1);
        }
        turtle.right((360 / angles).into());
    }
}

fn main() {
    turtle::start();
    let mut t1 = turtle::Turtle::new();
    t1.set_speed("instant");
   // Doesn't crash if you comment the following line or change it to 2.0
    t1.set_pen_size(1.0);
    fractal(&mut t1, 160.0, 5, 3);
}

glitches and then crashes without any error message leaving only error code 1.

Possibly relevant environment: Debian 9 in Qubes OS, Rust 1.45.0

@sunjay
Copy link
Owner

sunjay commented Sep 20, 2020

Interesting! Could you tell me what version of the turtle crate you are using? Does it still happen if you change your Cargo.toml to use the following?

turtle = {git = "https://github.com/sunjay/turtle", rev = "bf64b8333a2be1914378d8a22a4788947711182b"}

If it still crashes with that, try removing the "rev" part and running cargo update. That should run the program with the latest changes on master. Let me know if it still crashes with that.

To summarize: the version published on crates.io is fairly out of date and some of the dependencies may be causing a crash. The specific rev I pointed to has a more recent version of the dependencies and so may fix this issue for now. The master branch has the latest version of the crate but unfortunately we have a bunch of platform specific issues in our dependencies (#183) that make it very difficult to do a release right now.

Please let me know if any of that works/if it changes anything! Thanks for taking the time to report this!

@Kixunil
Copy link
Author

Kixunil commented Sep 20, 2020

I had turtle = "1.0.0-rc.3", after changing to turtle = {git = "https://github.com/sunjay/turtle", rev = "bf64b8333a2be1914378d8a22a4788947711182b"} it works! I tried to fiddle with the values a bit and it didn't crash at all.

Thanks, closing in favor of #183

@Kixunil Kixunil closed this as completed Sep 20, 2020
@sunjay
Copy link
Owner

sunjay commented Sep 20, 2020

Great! Glad we were able to get it fixed! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants