-
Notifications
You must be signed in to change notification settings - Fork 920
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
WindowHandle
is not sound
#3317
Comments
Would be best IMO to just keep the display handle alive when a window is alive. Feels more semantically sound. Just keep the |
You don't have handle on macOS though, that's the issue. |
My impression for macOS though is that, when the event loop ends, the application exits, effectively preventing the Windows from being accessed. So this isn't a problem there. |
I remember there were caveats around that and that's part of the reason we explicitly require drop for windows between |
For the platforms I know:
Do you have a link to this discussion? There's probably something I've missed. |
Only iOS. But on macOS, |
For reference: @daxpedda noted in #3367 (comment) under "Nothing Outlives the Event Loop" that one solution could be: the event loop can't be exited without dropping all Further discussion notes from out meeting last week in here. Direct |
Currently, the
rwh::WindowHandle
we return gets a lifetime toWindow
. Unfortunately this doesn't really work out because the actual lifetime of theWindow
isn't connected to it's semantic lifetime. If theEventLoop
is exited, allWindow
s become invalid, therefor making all connectedWindowHandle
s unsound to continue to use.One simple solution that was proposed in IRC by Ralith is to extend the lifetime of all
Window
s even after theEventLoop
was exited. This might be a viable solution as recreating theEventLoop
isn't allowed anyway (except on Web).For a more "proper" solution, we would have to introduce a lifetime to
Window
that is connected to theEventLoop
. This would require a major API re-design.Also discussed in:
WindowHandle
s to imilictly ref-count raw-window-handle#158The text was updated successfully, but these errors were encountered: