src/SDL.c
changeset 5257 956d42855c92
parent 5221 2ee8112bfc6b
child 5262 b530ef003506
equal deleted inserted replaced
5256:bbdf9250ee8b 5257:956d42855c92
    27 #include "SDL_fatal.h"
    27 #include "SDL_fatal.h"
    28 #include "SDL_assert_c.h"
    28 #include "SDL_assert_c.h"
    29 #include "haptic/SDL_haptic_c.h"
    29 #include "haptic/SDL_haptic_c.h"
    30 #include "joystick/SDL_joystick_c.h"
    30 #include "joystick/SDL_joystick_c.h"
    31 
    31 
    32 #if !SDL_VIDEO_DISABLED
       
    33 #include "video/SDL_leaks.h"
       
    34 #endif
       
    35 
       
    36 /* Initialization/Cleanup routines */
    32 /* Initialization/Cleanup routines */
    37 #if !SDL_TIMERS_DISABLED
    33 #if !SDL_TIMERS_DISABLED
    38 extern void SDL_StartTicks(void);
    34 extern void SDL_StartTicks(void);
    39 extern int SDL_TimerInit(void);
    35 extern int SDL_TimerInit(void);
    40 extern void SDL_TimerQuit(void);
    36 extern void SDL_TimerQuit(void);
    47 
    43 
    48 /* The initialized subsystems */
    44 /* The initialized subsystems */
    49 static Uint32 SDL_initialized = 0;
    45 static Uint32 SDL_initialized = 0;
    50 static Uint32 ticks_started = 0;
    46 static Uint32 ticks_started = 0;
    51 
    47 
    52 #ifdef CHECK_LEAKS
       
    53 int surfaces_allocated = 0;
       
    54 #endif
       
    55 
    48 
    56 int
    49 int
    57 SDL_InitSubSystem(Uint32 flags)
    50 SDL_InitSubSystem(Uint32 flags)
    58 {
    51 {
    59 #if !SDL_VIDEO_DISABLED
    52 #if !SDL_VIDEO_DISABLED
   217     /* Quit all subsystems */
   210     /* Quit all subsystems */
   218 #if defined(__WIN32__)
   211 #if defined(__WIN32__)
   219     SDL_HelperWindowDestroy();
   212     SDL_HelperWindowDestroy();
   220 #endif
   213 #endif
   221     SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
   214     SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
   222 
       
   223 #ifdef CHECK_LEAKS
       
   224     /* !!! FIXME: make this an assertion. */
       
   225     /* Print the number of surfaces not freed */
       
   226     if (surfaces_allocated != 0) {
       
   227         fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
       
   228                 surfaces_allocated);
       
   229     }
       
   230 #endif
       
   231 
   215 
   232     /* Uninstall any parachute signal handlers */
   216     /* Uninstall any parachute signal handlers */
   233     SDL_UninstallParachute();
   217     SDL_UninstallParachute();
   234 
   218 
   235     SDL_ClearHints();
   219     SDL_ClearHints();