-
Notifications
You must be signed in to change notification settings - Fork 930
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
[MacOS] Dialogues freeze when used in winit event loop #1779
Comments
This sounds like you're blocking inside of the event loop? Shouldn't the expected result be that the application then freezes, or what do you expect? The handling of events has been stopped. |
The application should freeze (it did) as MacOS is doing its work with dialog. But for some reason system dialog also freezes. Or maybe it's my lack of Mac knowledge, is winit event loop somehow tied to system dialogs? |
Which macOS version? |
Mac OS X 10.15.6 (as stated in the issue) |
Ah, I missed that. Hm, according to macOS docs it says the dialog boxes should be handled by a completely separate process. Though I'm not sure how exactly you hook them up. |
I'm quite confused, I never encountered such a behavior in the SDL world |
Small update on my findings:When testing without any winit window opened:
I located a nice example of this behavior in handle_nonuser_event fn handle_nonuser_event(&self, wrapper: EventWrapper) {
// Dialog Still works
rfd::open();
if let Some(ref mut callback) = *self.callback.lock().unwrap() {
// Nope after the lock this one is frozen
rfd::open();
match wrapper {
EventWrapper::StaticEvent(event) => {
callback.handle_nonuser_event(event, &mut *self.control_flow.lock().unwrap())
}
EventWrapper::EventProxy(proxy) => self.handle_proxy(proxy, callback),
}
}
// After the unlock we are back in business, works as expected
rfd::open();
} EDIT: I belive I understand whats heappending now. // 1. handle_nonuser_event() called for the first time.
StaticEvent(
NewEvents(
Init,
),
)
// 2. I'm opening a dialog inside of event loop callback
// 3. handle_nonuser_event() is called for the second time.
// heapens exacly when dialogs shows up
// I'm preaty sure that this event is caused by dialog
StaticEvent(
NewEvents(
Poll,
),
)
// 4. We have a frozzen program, Pool Event is waiting for unlock, but unlock will never heappen EDIT2:
EDIT3: Just in case that my explanation sucks, here is a diagram of what I think is happening: |
@vbogaevsky Example implementation of this change: PolyMeilex@69a6129@chrisduerr |
Any update on this @chrisduerr ? |
I am also having this problem. Opening a file dialog with either Also, |
Both |
I've been using PolyMeilex's fork of |
|
I'm using my fork in my |
Oh so I guess this was the issue you mentioned to me @adamnemecek. I think that the I just wanted to write this down but unfortunately I don't have time look into this right now, but I will do hopefully soon. This whole re-entrance and locking thing might actually be the reason why we queue events instead of dispatching them synchronously, but I'm not sure and that's mostly related to #1911. |
Previously app code was run from within the event loop which lead to file dialogs (e.g. using nfd2) to hang (see rust-windowing/winit#1779) Now egui_glium polls for events and then runs the app code.
I managed to fix this by switching from |
Previously app code was run from within the event loop which lead to file dialogs (e.g. using nfd2) to hang (see rust-windowing/winit#1779) Now egui_glium polls for events and then runs the app code.
…k#631) Previously app code was run from within the event loop which lead to file dialogs (e.g. using nfd2) to hang (see rust-windowing/winit#1779) Now egui_glium polls for events and then runs the app code.
OS: OSX 10.15.6
Hi I'm working on
RustyFileDialog
crate, and in the process I found out weird issue related to winit event loop.(To make it easier to reproduce I'll use
nfd2
as an example instead of my impl.)File dialogs, for example from
nfd2
freeze when opened from winit event loop.Example:
More info
NSOpenPanel
is used, and it is opened withrunModal
(blocking)beginWithCompletionHandler
(non-blocking) dialog works as expectedNSOpenPanel
is frozenThe text was updated successfully, but these errors were encountered: