mirror of
https://github.com/glfw/glfw.git
synced 2024-11-29 07:34:35 +00:00
Do not leak the 1×1 buffer used for decorations
This commit is contained in:
parent
0c4ca85149
commit
dfc7eacd50
@ -247,18 +247,23 @@ static void createDecorations(_GLFWwindow* window)
|
|||||||
if (!_glfw.wl.viewporter)
|
if (!_glfw.wl.viewporter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct wl_buffer* buffer = createShmBuffer(&image);
|
if (!window->wl.decorations.buffer)
|
||||||
|
window->wl.decorations.buffer = createShmBuffer(&image);
|
||||||
|
|
||||||
createDecoration(&window->wl.decorations.top, window->wl.surface, buffer,
|
createDecoration(&window->wl.decorations.top, window->wl.surface,
|
||||||
|
window->wl.decorations.buffer,
|
||||||
0, -_GLFW_DECORATION_TOP,
|
0, -_GLFW_DECORATION_TOP,
|
||||||
window->wl.width, _GLFW_DECORATION_TOP);
|
window->wl.width, _GLFW_DECORATION_TOP);
|
||||||
createDecoration(&window->wl.decorations.left, window->wl.surface, buffer,
|
createDecoration(&window->wl.decorations.left, window->wl.surface,
|
||||||
|
window->wl.decorations.buffer,
|
||||||
-_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP,
|
-_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
||||||
createDecoration(&window->wl.decorations.right, window->wl.surface, buffer,
|
createDecoration(&window->wl.decorations.right, window->wl.surface,
|
||||||
|
window->wl.decorations.buffer,
|
||||||
window->wl.width, -_GLFW_DECORATION_TOP,
|
window->wl.width, -_GLFW_DECORATION_TOP,
|
||||||
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
_GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP);
|
||||||
createDecoration(&window->wl.decorations.bottom, window->wl.surface, buffer,
|
createDecoration(&window->wl.decorations.bottom, window->wl.surface,
|
||||||
|
window->wl.decorations.buffer,
|
||||||
-_GLFW_DECORATION_WIDTH, window->wl.height,
|
-_GLFW_DECORATION_WIDTH, window->wl.height,
|
||||||
window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH);
|
window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH);
|
||||||
}
|
}
|
||||||
@ -837,6 +842,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
window->context.destroy(window);
|
window->context.destroy(window);
|
||||||
|
|
||||||
destroyDecorations(window);
|
destroyDecorations(window);
|
||||||
|
if (window->wl.decorations.buffer)
|
||||||
|
wl_buffer_destroy(window->wl.decorations.buffer);
|
||||||
|
|
||||||
if (window->wl.native)
|
if (window->wl.native)
|
||||||
wl_egl_window_destroy(window->wl.native);
|
wl_egl_window_destroy(window->wl.native);
|
||||||
|
Loading…
Reference in New Issue
Block a user