From 0c27ed1d0ef36672f0ef28d86bf8e108cc6e379d 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 --- 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 23dc89ad..89356671 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2997,8 +2997,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,