SDL bug report

I’m not sure I’v not modified my file before, but it was written so:
file "SDL_surface.c"
line 769:“if ( (surface->refcount) > 0 ){“
line 770:” return;”

bur onstructor create a value set so: “surface->refcount=1”

Ti I don’t change the line, SDL_FreeSurface() do not
really free any alocated surface.

I then changed the line to:
line 769:“if ( (surface->refcount) < 0 ) {“
line 770:” return;”

so it allow him to free memory.

Luc-Olivier de Charri?re

I’m not sure I’v not modified my file before, but it was written so:
file "SDL_surface.c"
line 769:“if ( (surface->refcount) > 0 ){“
line 770:” return;”

No, it is:

if ( --surface->refcount > 0 ) {
	return;
}

Note the predecrement.

I then changed the line to:
line 769:“if ( (surface->refcount) < 0 ) {“
line 770:” return;”

This is just plain wrong

I then changed the lines to:
if ( (surface->refcount) < 0 ) {“
return;”
}
This is just plain wrong

Why ?
Then what should I do to free memory ?

If I create a new SDL_surface, and just after I free it,
with given functions, it do not free it otherwise !

The constructor create a surface with “surface->refcount=1”.
If I do not modify the SDL_free_Surface(), it never free any surface,
because nothig is going to change “surface->refcount” higher than zero!

Luc-Olivier de Charri?re