mispy-archive / libtcod

Ruby bindings for the libtcod roguelike library
MIT License
32 stars 12 forks source link

libtcod-ruby-test hangs on quit #9

Open suetanvil opened 10 years ago

suetanvil commented 10 years ago

The example program libtcod-ruby-test works fine on my system. However, when I exit by pressing ESC, the program closes the main window and hangs. Standard CTRL+C kills the program.

I placed a puts at the end of the program and that executes.

I've tried recompiling libtcod from source against my system's SDL and I still get the same behaviour. Doing a backtrace in gdb shows it's hanging in pthread_join called from SDL_WaitThread() and (via some intermediate functions) SDL_Quit().

I'm running 64-bit Ubuntu 13.10 on an AMD system.

suetanvil commented 10 years ago

It looks like it's due to the timer subsystem. The thread it's waiting on seems to be launched by that.

As far as I can tell right now, libtcod isn't using the SDL timer but it enables the subsystem. When I disable it:

src/sys_sdl_c.c, line 778:
-       TCOD_IFNOT(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) >= 0 ) return;
+/*     TCOD_IFNOT(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) >= 0 ) return;*/
+       TCOD_IFNOT(SDL_Init(SDL_INIT_VIDEO) >= 0 ) return;

the problem goes away.