X11 : fix crash in Handle_SelectionNotify() when Clipboard cannot be converted to UTF8_STRING
This commit is contained in:
parent
75210cfe7c
commit
a68343d2ad
25
src/input.c
25
src/input.c
@ -478,15 +478,26 @@ static int Handle_SelectionNotify(const XSelectionEvent* xselection)
|
|||||||
unsigned long count = 0, bytesAfter = 0;
|
unsigned long count = 0, bytesAfter = 0;
|
||||||
unsigned char * value = NULL;
|
unsigned char * value = NULL;
|
||||||
|
|
||||||
r = XGetWindowProperty(X11_display, X11_window, xselection->property, 0, LONG_MAX,
|
GFX2_Log(GFX2_DEBUG, "xselection: selection=%s property=%s target=%s\n",
|
||||||
False, xselection->target /* type */, &type, &format,
|
XGetAtomName(X11_display, xselection->selection),
|
||||||
&count, &bytesAfter, &value);
|
xselection->property == None ? "None" : XGetAtomName(X11_display, xselection->property),
|
||||||
if (r == Success && value != NULL)
|
XGetAtomName(X11_display, xselection->target));
|
||||||
|
if (xselection->property != None)
|
||||||
{
|
{
|
||||||
X11_clipboard = strdup((char *)value);
|
r = XGetWindowProperty(X11_display, X11_window, xselection->property, 0, LONG_MAX,
|
||||||
XFree(value);
|
False, xselection->target /* type */, &type, &format,
|
||||||
|
&count, &bytesAfter, &value);
|
||||||
|
if (r == Success && value != NULL)
|
||||||
|
{
|
||||||
|
X11_clipboard = strdup((char *)value);
|
||||||
|
XFree(value);
|
||||||
|
}
|
||||||
|
user_feedback_required = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GFX2_Log(GFX2_INFO, "X11 Selection conversion failed\n");
|
||||||
}
|
}
|
||||||
user_feedback_required = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user