6 Multiple copy issues
Camilla Löwy edited this page 2023-02-20 18:52:05 +01:00

This is a collection of issues caused by having multiple copies of GLFW in use in the same process, whether the same version or different ones.

Context API TLS

Each copy of GLFW assumes nothing else makes a context current and that the context API's TLS slot remains in sync with its own.

Gamma ramp restoration

Each copy of GLFW saves the original gamma ramp of a monitor immediately before the first time it is set. The original ramp is then restored at termination. Depending on order of termination, a copy may overwrite the correctly restored ramp with values set by a different copy.

Video mode restoration

Each copy of GLFW saves the original video mode of a monitor immediately before the first time it is set. The original ramp is then restored at window iconification, window destruction or termination. Depending on the order of operations, a copy may overwrite the correctly restored video mode with one set by a different copy.

Cocoa menu bar

Cocoa application delegate

The Cocoa application singleton has a single slot for a delegate object. Only one copy can have its delegate set.

Disabled cursor mode

Win32 cursor trails setting

The cursor trails accessibility feature is disabled when entering full screen mode as it severely impacted OpenGL performance. It is restored to its original setting when restoring the video mode. If multiple copies create full screen windows, cursor trails will become disabled.

X11 wait events

Each copy of GLFW has its own connection to the X server and events are only sent to the connection that created the window. If one copy blocks waiting for events, windows created by other copies will stop responding.

Wayland wait events

Each copy of GLFW has its own connection to the Wayland compositor and events are only sent to the connection that created the window. If one copy blocks waiting for events, windows created by other copies will stop responding.

X11 clipboard transfer

X11 clipboard transfer is an async protocol coordinated via window properties (😱) and clipboard retrieval is implemented via a custom event loop. This does not allow other copies to process events, meaning clipboard transfer between copies would deadlock.

Wayland clipboard transfer

Cocoa current directory

By default the current directory is set to the Resources directory of the application bundle at init. The init hint that controls this only affects that copy.