[#17850] Copying text from Eric4 to Blender crashes Blender

The crash is caused by calling XGetWindowProperty when xevent.xselection.property is zero.
Not a proper fix because clipboard can paste the data without trouble.
This commit is contained in:
Campbell Barton 2009-01-27 08:17:35 +00:00
parent 9146687ffc
commit d95d110d8d

@ -1032,7 +1032,8 @@ getClipboard(int flag
while(1) {
XNextEvent(m_display, &xevent);
if(xevent.type == SelectionNotify) {
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property , 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (data) {
tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
strcpy((char*)tmp_data, (char*)data);
@ -1040,6 +1041,10 @@ getClipboard(int flag
return (GHOST_TUns8*)tmp_data;
}
}
}
else {
fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem!
}
return NULL;
}
}