check for empty X11 clipboard data

This commit is contained in:
Thomas Bernard 2019-02-15 13:09:36 +01:00
parent 22a895f45c
commit a808eaa9bb
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -536,6 +536,8 @@ static int Handle_SelectionNotify(const XSelectionEvent* xselection)
GFX2_Log(GFX2_DEBUG, "Clipboard value=%p %lu bytes format=%d type=%s\n",
value, count, format, type_name);
XFree(type_name);
if (count > 0)
{
X11_clipboard_size = count;
if (xselection->target == XInternAtom(X11_display, "UTF8_STRING", False))
X11_clipboard = strdup((char *)value); // Text Clipboard
@ -545,6 +547,7 @@ static int Handle_SelectionNotify(const XSelectionEvent* xselection)
if (X11_clipboard != NULL)
memcpy(X11_clipboard, value, count);
}
}
XFree(value);
}
else