diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-17 17:59:26 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-19 15:27:38 -0500 |
commit | d7234f4d7e373a708e1df9ab565a71b71b189025 (patch) | |
tree | e4db9e84d66e448fdda3fe426fd3904eba8a5382 /sdl.c | |
parent | 3b6304f706ef7eebc0b3b3f3a5093ec75448ee19 (diff) |
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit from
exit_notifier. However, using exit_notifier means that there's one less
justification for having global state in the first place.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sdl.c')
-rw-r--r-- | sdl.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -827,7 +827,7 @@ static void sdl_mouse_define(int width, int height, int bpp, SDL_SetCursor(guest_sprite); } -static void sdl_cleanup(void) +static void sdl_cleanup(Notifier *notifier) { if (guest_sprite) SDL_FreeCursor(guest_sprite); @@ -840,6 +840,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) uint8_t data = 0; DisplayAllocator *da; const SDL_VideoInfo *vi; + static Notifier exit_notifier = { .notify = sdl_cleanup }; #if defined(__APPLE__) /* always use generic keymaps */ @@ -892,7 +893,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal = SDL_GetCursor(); - atexit(sdl_cleanup); + exit_notifier_add(&exit_notifier); if (full_screen) { gui_fullscreen = 1; gui_fullscreen_initial_grab = 1; |