Re: [AD] timer_mutex again |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Thanks, I'll add that. But this is not something that could happen with
> the existing code, is it? If so, I'm stumped seeing how it could arise.
What existing code? The timer code _with_ the mutex guarantees that this
cannot happen. The timer code _without_ the mutex doesn't.
For example for show_mouse(NULL):
void show_mouse(BITMAP *bmp)
{
if (!mouse_driver)
return;
remove_int(mouse_move);
if (_mouse_screen) {
acquire_bitmap(_mouse_screen);
if (gfx_capabilities & GFX_HW_CURSOR) {
gfx_driver->hide_mouse();
gfx_capabilities &= ~GFX_HW_CURSOR;
}
else
draw_mouse(TRUE, FALSE);
release_bitmap(_mouse_screen);
}
_mouse_screen = bmp;
mouse_move draws on _mouse_screen so it could end up dereferencing the NULL
pointer, were remove_int not guaranteed to return only after mouse_move has
itself returned. IIRC that's the very problem that prompted me to devise this
stuff.
--
Eric Botcazou