--- xemacs-21.5.27.20060705.orig/src/select-x.c 2007-02-16 12:42:44.000000000 +0100 +++ xemacs-21.5.27.20060705/src/select-x.c 2007-02-16 16:09:32.000000000 +0100 @@ -1048,7 +1048,10 @@ return; } - total_size = bytes_remaining + 1; + if (sizeof(long) == 8 && *actual_format_ret == 32) + total_size = 2 * bytes_remaining + 1; + else + total_size = bytes_remaining + 1; *data_ret = xnew_rawbytes (total_size); /* Now read, until we've gotten it all. */ --- xemacs/src/select-x.c-dist 2007-02-15 01:49:41.000000000 +0100 +++ xemacs/src/select-x.c 2007-02-15 03:09:54.000000000 +0100 @@ -1072,7 +1074,13 @@ x_get_window_property (Display *display, reading it. Deal with that, I guess.... */ if (result != Success) break; - *actual_size_ret *= *actual_format_ret / 8; + /* What a mess, XGetWindowProperty() returns "long" array on LP64 + even if format == 32... + */ + if (sizeof(long) == 8 && *actual_format_ret == 32) + *actual_size_ret *= 8; + else + *actual_size_ret *= *actual_format_ret / 8; memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret); offset += *actual_size_ret; XFree ((char *) tmp_data);