Wayland: Fix glfwPostEmptyEvent leaking a proxy

The client-side proxy of the callback from each call to wl_display_sync
was never destroyed.

Fixes #2836
This commit is contained in:
Camilla Löwy
2026-03-11 19:52:04 +01:00
parent 50b0a135a5
commit bb8048122a
3 changed files with 15 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ video tutorials.
- Jason Daly
- danhambleton
- Jarrod Davis
- Aaron Day
- decce
- Olivier Delannoy
- Paul R. Deppe

View File

@@ -155,6 +155,7 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: Mouse wheel scroll distance was incorrect on some compositors
- [Wayland] Bugfix: `glfwSwapBuffers` would halt with nonzero swap interval when window
was suspended (#1350,#2582,#2640,#2719,#2723,#2800,#2827)
- [Wayland] Bugfix: `glfwPostEmptyEvent` would leak a callback proxy (#2836)
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale

View File

@@ -199,6 +199,16 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
return buffer;
}
static void callbackHandleDone(void* userData, struct wl_callback* callback, uint32_t data)
{
wl_callback_destroy(callback);
}
static const struct wl_callback_listener noopCallbackListener =
{
callbackHandleDone
};
static void createFallbackEdge(_GLFWwindow* window,
_GLFWfallbackEdgeWayland* edge,
struct wl_surface* parent,
@@ -2930,7 +2940,9 @@ void _glfwWaitEventsTimeoutWayland(double timeout)
void _glfwPostEmptyEventWayland(void)
{
wl_display_sync(_glfw.wl.display);
struct wl_callback* callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(callback, &noopCallbackListener, NULL);
flushDisplay();
}