From 1d711057a17de4747c570356660da5aa421dbb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 24 Jan 2020 09:34:54 +0100 Subject: [PATCH] X11: Fix setting the clipboard string to itself (cherry picked from commit 0c27ed1d0ef36672f0ef28d86bf8e108cc6e379d) --- src/x11_window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/x11_window.c b/src/x11_window.c index 271e1080..3c03ccda 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2950,8 +2950,9 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) void _glfwPlatformSetClipboardString(const char* string) { + char* copy = _glfw_strdup(string); free(_glfw.x11.clipboardString); - _glfw.x11.clipboardString = _glfw_strdup(string); + _glfw.x11.clipboardString = copy; XSetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD,