Avoid deadlock in VGA_DoSetMode.

This commit is contained in:
Christian Costa 2002-05-11 23:00:17 +00:00 committed by Alexandre Julliard
parent 470a3f93eb
commit 4a0a2ee00e
1 changed files with 13 additions and 13 deletions

View File

@ -232,6 +232,18 @@ typedef struct {
int ret;
} ModeSet;
static void WINAPI VGA_DoExit(ULONG_PTR arg)
{
VGA_DeinstallTimer();
IDirectDrawSurface_SetPalette(lpddsurf,NULL);
IDirectDrawSurface_Release(lpddsurf);
lpddsurf=NULL;
IDirectDrawPalette_Release(lpddpal);
lpddpal=NULL;
IDirectDraw_Release(lpddraw);
lpddraw=NULL;
}
static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
{
LRESULT res;
@ -239,7 +251,7 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
ModeSet *par = (ModeSet *)arg;
par->ret=1;
if (lpddraw) VGA_Exit();
if (lpddraw) VGA_DoExit(NULL);
if (!lpddraw) {
if (!pDirectDrawCreate)
{
@ -334,18 +346,6 @@ int VGA_GetMode(unsigned*Height,unsigned*Width,unsigned*Depth)
return 0;
}
static void WINAPI VGA_DoExit(ULONG_PTR arg)
{
VGA_DeinstallTimer();
IDirectDrawSurface_SetPalette(lpddsurf,NULL);
IDirectDrawSurface_Release(lpddsurf);
lpddsurf=NULL;
IDirectDrawPalette_Release(lpddpal);
lpddpal=NULL;
IDirectDraw_Release(lpddraw);
lpddraw=NULL;
}
void VGA_Exit(void)
{
if (lpddraw) MZ_RunInThread(VGA_DoExit, 0);