A devious idea - I wonder if just pushing a global GDK error trap at the beginning when we bring up the process would ultimately cause these races to cancel out? Most of these explicit XSetError error traps (like in Cairo), we don't actually care if they run, so long as X11 errors are supressed, because they never actually analyze the error generated, or if there even was an error other than the function returning null. The global GDK error trap would cause the previous handler at the time of any XSetError calls outside GDK to always be GDK's. So even if there would end up being a race in XSetError between Cairo and GDK, the race would always end up installing GDK's handler (because Cairo would try to reinstate GDK's handler), which would suppress the error since GDK wants to store it for the global error trap. Net result - no crashiness, a couple lines of code... In truth, we have a couple other places in the code that call XSetError (like gfx/gl), not just from Cairo, so this would be a catch-all solution to help all these random cases.
Bug 1741956 Comment 6 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
A devious idea - I wonder if just pushing a global GDK error trap at the beginning when we bring up the process would ultimately cause these races to cancel out? Most of these explicit XSetError error traps (like in Cairo), we don't actually care if they run, so long as X11 errors are supressed, because they never actually analyze the error generated, or if there even was an error other than the function returning null. The global GDK error trap would cause the previous handler at the time of any XSetError calls outside GDK to always be GDK's. So even if there would end up being a race in XSetError between Cairo and GDK, the race would always end up installing GDK's handler (because Cairo would try to reinstate GDK's handler), which would suppress the error since GDK wants to store it for the global error trap. Net result - no crashiness, a couple lines of code... In truth, we have a couple other places in the code that call XSetError (like gfx/gl), not just from Cairo, so this would be a catch-all solution to help all these random cases. I don't think we want X11 errors going unhandled and taking down the browser anyway, so a global GDK error trap would make sense...