From d6a5f9c394aea65684aa9d340ef26849bf49a2cc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 9 Sep 2022 23:28:08 +0200 Subject: Fail mgl_window_get_clipboard_string on timeout --- src/window/window.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/window/window.c b/src/window/window.c index b4443e2..a7c9a71 100644 --- a/src/window/window.c +++ b/src/window/window.c @@ -1039,7 +1039,12 @@ bool mgl_window_get_clipboard_string(mgl_window *self, char **str, size_t *size) ClipboardStringCallbackData callback_data; callback_data.str = str; callback_data.size = size; - return mgl_window_get_clipboard(self, clipboard_copy_string_callback, &callback_data); + const bool success = mgl_window_get_clipboard(self, clipboard_copy_string_callback, &callback_data); + if(!success) { + free(*str); + *size = 0; + } + return success; } void mgl_window_set_key_repeat_enabled(mgl_window *self, bool enabled) { -- cgit v1.2.3