1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Fix loading saved states on 64-bit systems

One misuse of CARD32 was missed back when someone fixed the 64-bit
issues (background: X has 8-bit, 16-bit, and "32-bit stored in a long"
data formats; on a 64-bit system, long is 64 bits). This was causing
minimized windows to be restored as shaded, and possibly occasional
crashes, when wmaker was restarted.

Also, throw in a safety check that 10 items really were returned before
trying to access them.
This commit is contained in:
Brad Jorsch
2010-04-09 15:49:06 -04:00
committed by Carlos R. Mafra
parent 518b3b4480
commit 37829a7c60

View File

@@ -2338,12 +2338,12 @@ static int getSavedState(Window window, WSavedState ** state)
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
CARD32 *data;
long *data;
if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 10,
True, _XA_WINDOWMAKER_STATE,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data) != Success || !data)
(unsigned char **)&data) != Success || !data || nitems_ret < 10)
return 0;
*state = wmalloc(sizeof(WSavedState));