-
Notifications
You must be signed in to change notification settings - Fork 921
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
Make Windows main thread checks more forgiving #4003
base: master
Are you sure you want to change the base?
Conversation
The check on Windows to enforce that the event loop is created from the main thread is not fully reliable (rust-windowing#3999). Given that this check is not necessary on Windows and only exists more as an assert to enforce platform consistency in development, I have made it more lax: * It now produces a tracing::warn!() message instead of an outright panic. * The check is only compiled in with cfg(debug_assertions)
I ran cargo fmt and it just broke... oh well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only relax this check if it's being called from a DLL.
Any idea how we'd go about checking that? |
This is checked by comparing the executing module (via GetModuleHandleExA GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS) with GetModuleHandleA(NULL). If these are the same we're statically linked into the .exe.
Alright, I figured out a way to check it, hope this is sufficient. |
I would rather use a better way to detect if we are on the main thread, if possible. I've opened #4006 for this. Let me know if it works. |
The check on Windows to enforce that the event loop is created from the main thread is not fully reliable (#3999). Given that this check is not necessary on Windows and only exists more as an assert to enforce platform consistency in development, I have made it more lax:
Fixes #3999
changelog
module if knowledge of this change could be valuable to users