X11: Fix a crash if the X server requests clipboard data after we have relinquished the clipboard

Fixes #5650
This commit is contained in:
Kovid Goyal 2023-03-07 13:53:07 +05:30
parent ecfebcd6af
commit 672ecde68b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,8 @@ Detailed list of changes
- Wayland KDE: Fix selecting in un-focused OS window not working correctly (:iss:`6095`) - 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] 0.27.1 [2023-02-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1
glfw/x11_window.c vendored
View File

@ -719,6 +719,7 @@ static bool createNativeWindow(_GLFWwindow* window,
static size_t static size_t
get_clipboard_data(const _GLFWClipboardData *cd, const char *mime, char **data) { get_clipboard_data(const _GLFWClipboardData *cd, const char *mime, char **data) {
*data = NULL; *data = NULL;
if (cd->get_data == NULL) { return 0; }
GLFWDataChunk chunk = cd->get_data(mime, NULL, cd->ctype); GLFWDataChunk chunk = cd->get_data(mime, NULL, cd->ctype);
char *buf = NULL; char *buf = NULL;
size_t sz = 0, cap = 0; size_t sz = 0, cap = 0;