This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed blit mapping problem when surfaces are freed and then newly all…
…ocated at the same address. Tim Angus to SDL void function( SDL_Surface* surface ) { SDL_Surface* anotherSurface = SDL_ConvertSurfaceFormat( surface, ... ); // surface->map->dst is now equal to anotherSurface // Do some stuff with anotherSurface SDL_FreeSurface( anotherSurface ); // anotherSurface is now a dead pointer, // but surface->map->dst still points to it } int main( ) { SDL_Surface* surface = CreateAValidSurface( ); function( surface ); } At this point blit something from surface. SDL_LowerBlit is called, which checks surface->map->dst against the blit destination. If the pointers happen to match (not that unlikely), the map is decided to be valid and bad things happen. It seems to me like the whole idea of caching the blit mapping is fundamentally flawed in that the source surface has no knowledge of the lifetime of the destination surface.
- Loading branch information