src/video/dga/SDL_dgavideo.c
changeset 1786 473abd216edb
parent 1785 dcec47a019e2
child 1800 cc6bea4bb90d
--- 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);