diff src/video/dga/SDL_dgavideo.c @ 1786:473abd216edb

Fixed bug #106 Wait for any pending operations to complete before freeing a hardware surface.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 09 May 2006 06:44:47 +0000
parents dcec47a019e2
children cc6bea4bb90d
line wrap: on
line diff
--- 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);