Commit a93e2caf authored by Sam Lantinga's avatar Sam Lantinga

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
parent f210611d
...@@ -771,6 +771,13 @@ static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface) ...@@ -771,6 +771,13 @@ static void DGA_FreeHWSurface(_THIS, SDL_Surface *surface)
{ {
vidmem_bucket *bucket, *freeable; 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 */ /* Look for the bucket in the current list */
for ( bucket=&surfaces; bucket; bucket=bucket->next ) { for ( bucket=&surfaces; bucket; bucket=bucket->next ) {
if ( bucket == (vidmem_bucket *)surface->hwdata ) { if ( bucket == (vidmem_bucket *)surface->hwdata ) {
...@@ -1054,7 +1061,7 @@ void DGA_VideoQuit(_THIS) ...@@ -1054,7 +1061,7 @@ void DGA_VideoQuit(_THIS)
SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen); SDL_NAME(XDGACloseFramebuffer)(DGA_Display, DGA_Screen);
if ( this->screen ) { if ( this->screen ) {
/* Tell SDL not to free the pixels */ /* Tell SDL not to free the pixels */
this->screen->pixels = NULL; DGA_FreeHWSurface(this, this->screen);
} }
SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0); SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment