From 672ecde68b30344170d0528a0784fb43763ec50f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 7 Mar 2023 13:53:07 +0530 Subject: [PATCH] X11: Fix a crash if the X server requests clipboard data after we have relinquished the clipboard Fixes #5650 --- docs/changelog.rst | 2 ++ glfw/x11_window.c | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 950070aab..b69d1a214 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -78,6 +78,8 @@ Detailed list of changes - Wayland KDE: Fix selecting in un-focused OS window not working correctly (:iss:`6095`) +- X11: Fix a crash if the X server requests clipboard data after we have relinquished the clipboard (:iss:`5650`) + 0.27.1 [2023-02-07] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 5fb567a19..137c69b2b 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -719,6 +719,7 @@ static bool createNativeWindow(_GLFWwindow* window, static size_t get_clipboard_data(const _GLFWClipboardData *cd, const char *mime, char **data) { *data = NULL; + if (cd->get_data == NULL) { return 0; } GLFWDataChunk chunk = cd->get_data(mime, NULL, cd->ctype); char *buf = NULL; size_t sz = 0, cap = 0;