-
Notifications
You must be signed in to change notification settings - Fork 948
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
[Windows] Not possible to create multiple windows (thread 'main' panicked at 'already mutably borrowed') #1400
Comments
#1427 has the beginning of an investigation into the issue. |
This panic also appears to be occur for some windows users when resizing and toggling fullscreen. pub(crate) unsafe fn send_event(&self, event: Event<'_, T>) {
let handling_redraw = self
.runner
.borrow()
.as_ref()
.map(|r| RunnerState::HandlingRedraw == r.runner_state)
.unwrap_or(false);
let mut send = None;
if handling_redraw {
if let Event::RedrawRequested(_) = event {
send = Some(event);
} else {
self.buffer_event(event);
}
} else {
send = Some(event);
}
if let Some(event) = send {
if let Err(event) = self.send_event_unbuffered(event) {
// If the runner is already borrowed, we're in the middle of an event loop invocation. Add
// the event to a buffer to be processed later.
self.buffer_event(event);
}
}
} The quickest solution would be to buffer the |
simplifies the message loops and event handling considerably strongly inspired from the X11 platform partially reverts rust-windowing@6a330a2 fixes rust-windowing#1400 fixes rust-windowing#1391
simplifies the message loops and event handling considerably strongly inspired from the X11 platform partially reverts rust-windowing@6a330a2 fixes rust-windowing#1400 fixes rust-windowing#1391
simplifies the message loops and event handling considerably strongly inspired from the X11 platform partially reverts rust-windowing@6a330a2 fixes rust-windowing#1400 fixes rust-windowing#1391
simplifies the message loops and event handling considerably strongly inspired from the X11 platform partially reverts rust-windowing@6a330a2 fixes rust-windowing#1400 fixes rust-windowing#1391
simplifies the message loops and event handling considerably strongly inspired from the X11 platform partially reverts rust-windowing@6a330a2 fixes rust-windowing#1400 fixes rust-windowing#1391
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
Just thought I'd add that we're also running into this on Windows in nannou. We are able to create multiple windows before running the event loop without any issue, however we trigger this same Here's the debug stacktrace:
|
@mitchmindtree could you try the branch associated to this PR : #1461 But note that you should probably not change the window state when handling a |
@filnet I can't test this right now, but will do so later on!
Yes you are right, this issue was the nudge we needed to fix this and we've since addressed it :) |
These panics were introduced by rust-windowing@6a330a2 Fixes rust-windowing#1391 Fixes rust-windowing#1400 Fixes rust-windowing#1466 Probably fixes other related issues See rust-windowing#1429
* On Windows, fix request_redraw() related panics These panics were introduced by 6a330a2 Fixes #1391 Fixes #1400 Fixes #1466 Probably fixes other related issues See #1429 * On Windows, replace all calls to UpdateWindow by calls to InvalidateRgn This avoids directly sending a WM_PAINT message, which might cause buffering of RedrawRequested events. We don't want to buffer RedrawRequested events because: - we wan't to handle RedrawRequested during processing of WM_PAINT messages - state transitionning is broken when handling buffered RedrawRequested events Fixes #1469 * On Windows, panic if we are trying to buffer a RedrawRequested event * On Windows, move modal loop jumpstart to set_modal_loop() method This fixes a panic. Note that the WM_PAINT event is now sent to the modal_redraw_method which is more correct and avoids an unecessary redraw of the window. Relates to but does does not fix #1484 * On Window, filter by paint messages when draining paint messages This seems to prevent PeekMessage from dispatching unrelated sent messages * Change recently added panic/assert calls with warn calls This makes the code less panicky... And actually, winit's Windoww callbacks should not panic because the panic will unwind into Windows code. It is currently undefined behavior to unwind from Rust code into foreign code. See https://doc.rust-lang.org/std/panic/fn.catch_unwind.html * add comments to clarify WM_PAINT handling in non modal loop * made redraw_events_cleared more explicit and more comments
Hi 🙂
Since 6a330a2 it is not possible to create multiple windows on Windows (10). It can be reproduced with
multiwindow
example. The singlewindow
example works fine though.The text was updated successfully, but these errors were encountered: