Repository navigation
platform-wl: Reuse wl_display between being checked and being used - #781
Conversation
In normal cases this shouldn't meaningfully change behavior. However if WAYLAND_SOCKET is set to an fd then wl_display_disconnect() closes that fd leaving it in a state where it cannot be reused. Fixes #728
aperezdc
left a comment
There was a problem hiding this comment.
Even when I have a small doubt (see comment), this solves the actual issue of not being able to open the connection to the Wayland compositor when WAYLAND_SOCKET is defined in the environment, so I think we should merge it.
If we find later on that we do not want to keep the wl_display alive we make a patch later for that.
| g_debug("Initializing Wayland..."); | ||
|
|
||
| CogWlDisplay *display = cog_wl_display_create(NULL, error); | ||
| CogWlDisplay *display = cog_wl_display_create(g_steal_pointer(&checked_wl_display), error); |
There was a problem hiding this comment.
Maybe we could do this only if WAYLAND_SOCKET was set? Or as an alternative, if the environment variable is set, we can dup() the file descriptor and open the duplicate for the check.
Either way, the idea is to avoid keeping a connected wl_display in case Cog ends up picking a different plugin in the end. But also I am not sure if it's worth the effort 🤔
There was a problem hiding this comment.
I tried dup but it didn't work. It’s left in a bad state if it’s reused anyway.
Originally i also limited it to when that's set but AFAICT if the plugin is ever checked for support and returns TRUE it's always used, so there is no risk of it left open.
|
The ARM cross-compilation is broken (#787) so let's merge this anyway. |
In normal cases this shouldn't meaningfully change behavior.
However if WAYLAND_SOCKET is set to an fd then wl_display_disconnect() closes that fd leaving it in a state where it cannot be reused.