diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-09-09 23:28:08 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-09-09 23:28:08 +0200 |
commit | d6a5f9c394aea65684aa9d340ef26849bf49a2cc (patch) | |
tree | acf91ffc034c0e7356c35e0977bd8dbe99d0f84c /src/window | |
parent | be7e74fe9b51123dec29f9ed9c0441dc8725dd1a (diff) |
Fail mgl_window_get_clipboard_string on timeout
Diffstat (limited to 'src/window')
-rw-r--r-- | src/window/window.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |