Re: [AD] screen double-free patch (allegro 4.03) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2003-04-23, "J.P. Morris" <jpm@xxxxxxxxxx> wrote:
> The following patch to src/graphics.c moves the 'destroy vram
> bitmap' loop so it happens after 'destroy_bitmap(screen);'. This
> prevents 'screen' from being freed twice (and thereby corrupting
> the heap and crashing in libc) when allegro is shut down.
Could you try the following test case? It doesn't crash for me,
but maybe it should do something else.
#define DEBUGMODE 1
#include <allegro.h>
int main(void)
{
int f;
TRACE("before allegro_init\n");
allegro_init();
TRACE("video call %d\n", set_gfx_mode(GFX_SAFE, 640, 480, 0, 0));
TRACE("driver: %s\n", system_driver->name);
for (f = 0; f < 10; f++)
if (create_video_bitmap(640, 480))
TRACE("video bitmap %d created\n", f);
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
TRACE("returning to OS\n");
allegro_exit();
return 0;
}
END_OF_MAIN()
> This should work, I don't make diff patches often:
The patch was ok.