xf86vmode_setdisplaymode() wasn't properly saving the 'private' field

of the XF86VidModeModeLine structure.
oldstable
William Waghorn 2000-10-25 21:27:16 +00:00 committed by Alexandre Julliard
parent 9a58351fda
commit 1e19fe323f
1 changed files with 10 additions and 2 deletions

View File

@ -170,7 +170,13 @@ xf86vmode_setdisplaymode(width,height) {
orig_mode->vsyncend = mod_tmp.vsyncend;
orig_mode->vtotal = mod_tmp.vtotal;
orig_mode->flags = mod_tmp.flags;
orig_mode->private = mod_tmp.private;
/* copy private data to our orig_mode structure */
orig_mode->privsize = mod_tmp.privsize;
if (orig_mode->privsize)
{
orig_mode->private = malloc(mod_tmp.privsize);
memcpy(orig_mode->private, mod_tmp.private, mod_tmp.privsize);
}
TSXF86VidModeGetAllModeLines(display,DefaultScreen(display),&mode_count,&all_modes);
for (i=0;i<mode_count;i++) {
@ -202,8 +208,10 @@ void xf86vmode_restore() {
if (!orig_mode)
return;
TSXF86VidModeSwitchToMode(display,DefaultScreen(display),orig_mode);
/* manually free the private data if it was allocated */
if (orig_mode->privsize)
TSXFree(orig_mode->private);
free(orig_mode->private);
free(orig_mode);
orig_mode = NULL;
}