forked from rust-windowing/glutin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a rare crash in some X11 implementations (details below).
In some X11 implementations, calling XCloseDisplay from any thread other than the main thread causes heap corruption and an eventual crash. Previously, the window proxy struct held a Weak<> ptr to the display, which was upgraded to a strong arc only during the send of the X message. However, if the main thread closes the window *after* the thread upgrades the weak ref, and this was the last strong reference, then the only remaining strong reference is in the window proxy thread, so the XCloseDisplay is executed on the thread. Instead, use a simpler solution where the display reference used by the window proxy threads is cleared by the main thread when the window is closed, and the XCloseDisplay can only be executed by the main thread. This has the added benefit of not relying on the unstable Weak<> library feature, so we will be able to get this upstreamed.
- Loading branch information
Showing
2 changed files
with
29 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters