Fixed bug #106
authorSam Lantinga <slouken@libsdl.org>
Tue, 09 May 2006 06:44:47 +0000
changeset 1786 473abd216edb
parent 1785 dcec47a019e2
child 1787 15ae67aa6b4b
Fixed bug #106 Wait for any pending operations to complete before freeing a hardware surface.
src/video/dga/SDL_dgavideo.c
--- a/src/video/dga/SDL_dgavideo.c	Tue May 09 06:14:11 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Tue May 09 06:44:47 2006 +0000
@@ -771,6 +771,13 @@
 {
 	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 @@
 		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);