X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg.h;h=64b6f6fc16dcf3c797d93c357cef6d5d4dd6f526;hb=8110d74786fb065c0e69f1e171a69e519c3f8c74;hp=eb858a38b33017d7fc20b5e457c91802d8c41b00;hpb=468a2c11d6c83e0e71e6ac87844e52cc4d49ccbc;p=vg.git diff --git a/vg.h b/vg.h index eb858a3..64b6f6f 100644 --- a/vg.h +++ b/vg.h @@ -635,8 +635,7 @@ VG_STATIC void _vg_init_window( const char *window_name ) { vg_info( "SDL_INIT\n" ); - if( SDL_Init( SDL_INIT_VIDEO ) != 0 ) - { + if( SDL_Init( SDL_INIT_VIDEO ) != 0 ){ vg_error( "SDL_Init failed: %s\n", SDL_GetError() ); exit(0); } @@ -664,8 +663,7 @@ VG_STATIC void _vg_init_window( const char *window_name ) */ vg_info( "Getting display count\n" ); int display_count = 0, display_index = 0, mode_index = 0; - if( (display_count = SDL_GetNumVideoDisplays()) < 1 ) - { + if( (display_count = SDL_GetNumVideoDisplays()) < 1 ){ vg_error( "SDL_GetNumVideoDisplays returned: %i\n", display_count ); exit(0); } @@ -820,22 +818,8 @@ VG_STATIC void vg_enter( int argc, char *argv[], const char *window_name ) SDL_Quit(); } -/* - * Immediately transfer away from calling thread into a safe loop, signal for - * others to shutdown, then free everything once the user closes the window. - * - * FIXME(bug): glfwWindowShouldClose() never returns 1 in windows via wine, ONLY - * when calling the program from outside its normal directory. - */ -VG_STATIC void vg_fatal_exit_loop( const char *error ) +void vg_print_backtrace(void) { - /* - * https://www.gnu.org/software/libc/manual/html_node/Backtraces.html - * thanks gnu <3 - * - * TODO: this on windows? - */ - #ifndef _WIN32 void *array[20]; @@ -858,7 +842,25 @@ VG_STATIC void vg_fatal_exit_loop( const char *error ) free( strings ); #endif +} + +/* + * Immediately transfer away from calling thread into a safe loop, signal for + * others to shutdown, then free everything once the user closes the window. + * + * FIXME(bug): glfwWindowShouldClose() never returns 1 in windows via wine, ONLY + * when calling the program from outside its normal directory. + */ +VG_STATIC void vg_fatal_exit_loop( const char *error ) +{ + /* + * https://www.gnu.org/software/libc/manual/html_node/Backtraces.html + * thanks gnu <3 + * + * TODO: this on windows? + */ + vg_print_backtrace(); vg_error( "Fatal error: %s\n", error ); SDL_AtomicLock( &vg.sl_context );