Skip to content

panic when closing window during render, Windows 10Β #103

@radix

Description

@radix

Hi, I have a program written with Piston/glutin_window that is getting a panic sometimes when I close the window. Here it is:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Error { repr: Os { code: 6, message: "The handle is invalid." } })', ../src/libcore\result.rs:799
stack backtrace:
   0:     0x7ff69262df44 - <std::sync::mpsc::RecvError as core::fmt::Debug>::fmt::h644c369fc7e7b3cf
   1:     0x7ff69262c3f3 - std::rt::lang_start::h538f8960e7644c80
   2:     0x7ff69262cdbd - std::panicking::rust_panic_with_hook::hc303199e04562edf
   3:     0x7ff69262cc56 - std::panicking::begin_panic_fmt::hc321cece241bb2f5
   4:     0x7ff69262cb74 - std::panicking::begin_panic_fmt::hc321cece241bb2f5
   5:     0x7ff69262cb0b - rust_begin_unwind
   6:     0x7ff692635595 - core::panicking::panic_fmt::h27224b181f9f037f
   7:     0x7ff69255ca8b - core::result::unwrap_failed<glutin::ContextError>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libcore\macros.rs:29
   8:     0x7ff692558bb1 - core::result::Result<(), glutin::ContextError>::unwrap<(),glutin::ContextError>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libcore\result.rs:737
   9:     0x7ff6925658ea - glutin_window::{{impl}}::make_current
                        at C:\Users\radix\.cargo\registry\src\github.com-1ecc6299db9ec823\pistoncore-glutin_window-0.33.0\src\lib.rs:413
  10:     0x7ff6924bc314 - piston_window::PistonWindow<glutin_window::GlutinWindow>::draw_2d<glutin_window::GlutinWindow,input::event::Event<input::Input>,closure,()>
                        at C:\Users\radix\.cargo\registry\src\github.com-1ecc6299db9ec823\piston_window-0.58.0\src\lib.rs:210
  11:     0x7ff69250b304 - main::App::render
                        at C:\Users\radix\Projects\circles\src\main.rs:69
  12:     0x7ff69250ced6 - main::main
                        at C:\Users\radix\Projects\circles\src\main.rs:320
  13:     0x7ff692630411 - _rust_maybe_catch_panic
  14:     0x7ff69262be2a - std::rt::lang_start::h538f8960e7644c80
  15:     0x7ff69252bc99 - main
  16:     0x7ff69263aa88 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  17:     0x7ff98e5538e3 - BaseThreadInitThunk
error: process didn't exit successfully: `target\debug\main.exe` (exit code: 101)

I'm not completely sure if this is glutin_window's fault or glutin's fault, but I think glutin_window since that's what I see deepest in the stack (glutin_window -> Result::unwrap). I also don't know if you consider this a bug or not. Probably the best thing would be for me to handle the window-close event in my game loop and cleanly shut down, though I haven't figured out how to do that yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions