From a93e2caf5c524862fb26c6e8e15c2d69a94bad4b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 9 May 2006 06:44:47 +0000 Subject: [PATCH] Fixed bug #106 Wait for any pending operations to complete before freeing a hardware surface. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401745 --- src/video/dga/SDL_dgavideo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video/dga/SDL_dgavideo.c b/src/video/dga/SDL_dgavideo.c index 57a15a72c..956807335 100644 --- a/src/video/dga/SDL_dgavideo.c +++ b/src/video/dga/SDL_dgavideo.c @@ -771,6 +771,13 @@ static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface) { vidmem_bucket *bucket, *freeable; + /* Wait for any pending operations involving this surface */ + if ( DGA_IsSurfaceBusy(surface) ) { + LOCK_DISPLAY(); + DGA_WaitBusySurfaces(this); + UNLOCK_DISPLAY(); + } + /* Look for the bucket in the current list */ for ( bucket=&surfaces; bucket; bucket=bucket->next ) { if ( bucket == (vidmem_bucket *)surface->hwdata ) { @@ -1054,7 +1061,7 @@ void DGA_VideoQuit(_THIS) SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen); if ( this->screen ) { /* Tell SDL not to free the pixels */ - this->screen->pixels = NULL; + DGA_FreeHWSurface(this, this->screen); } SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0);