Commits

Anonymous committed 8db7480

Fix GC error in SDL.mixer.Mix_ChannelFinished

  • Participants
  • Parent commits 28f54fd
  • Branches ctypes-soc

Comments (0)

Files changed (2)

  - pygame.Surface.set_clip with negative-sized rects.
  - pygame.Surface.set_at and .get_at for 24-bit surfaces.  Largely untested.
 
+SDL-ctypes 0.10
+---------------
+ - Mix_ChannelFinished fixed GC error.
+
 Pygame-ctypes 0.09
 ------------------
  - pygame.mixer.Channel.get/set_endevent fixed

File SDL/mixer.py

     arg_types=[_Mix_HookMusicFinishedFunc],
     return_type=None)
 
+# Keep the ctypes ref around
+_hookmusicfinished_ref = None
+
 def Mix_HookMusicFinished(music_finished):
     '''Add your own callback when the music has finished playing.
 
             The callback takes no arguments and returns no value.
 
     '''
+    global _hookmusicfinished_ref
     if music_finished:
-        _Mix_HookMusicFinished(_Mix_HookMusicFinishedFunc(music_finished))
+        _hookmusicfinished_ref = _Mix_HookMusicFinishedFunc(music_finished)
+        _Mix_HookMusicFinished(_hookmusicfinished_ref)
     else:
         _Mix_HookMusicFinished(_Mix_HookMusicFinishedFunc())