Skip to content

Window freezes instead of closing #185

@sunjay

Description

@sunjay

This is likely related at least in part to some of the issues in #183. In #173, we made it so that you could manage multiple turtle windows in multiple threads. We did that by no longer calling process::exit when a window is closed.

Unfortunately, if you create a window in a separate thread, closing the window doesn't actually cause the window to close. The following code reproduces the issue:

use std::thread;

use turtle::Turtle;

fn main() {
    turtle::start();

    thread::spawn(|| {
        let mut turtle = Turtle::new();

        for _ in 0..360 {
            // Move forward three steps
            turtle.forward(3.0);
            // Rotate to the right (clockwise) by 1 degree
            turtle.right(1.0);
            // panic!(); //TODO: Window should close
        }
    });

    thread::park();
}

Running this code and closing the window at any point should cause the window to disappear. Instead, the window remains open and freezes in place. The commented out panic!() should also cause the window to close, but it also results in the window just freezing instead.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions