From 597c68c2d8a50f21ea55cc070c85f6d4294810ed Mon Sep 17 00:00:00 2001 From: Sergio Gonzalez Date: Sat, 6 May 2017 21:08:20 -0500 Subject: [PATCH] Fix nvidia crash: gtk_init must be called after SDL_Init so that XInitThreads is the first Xlib function called. --- src/platform_unix.cc | 3 --- src/sdl_milton.cc | 7 +++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform_unix.cc b/src/platform_unix.cc index f84f8618..1154a2b4 100644 --- a/src/platform_unix.cc +++ b/src/platform_unix.cc @@ -112,9 +112,6 @@ platform_monitor_refresh_hz() int main(int argc, char** argv) { -#ifdef __linux__ - gtk_init(&argc, &argv); -#endif char* file_to_open = NULL; if ( argc == 2 ) { file_to_open = argv[1]; diff --git a/src/sdl_milton.cc b/src/sdl_milton.cc index 21efb800..2530e345 100644 --- a/src/sdl_milton.cc +++ b/src/sdl_milton.cc @@ -509,6 +509,7 @@ sdl_event_loop(MiltonState* milton_state, PlatformState* platform_state) int milton_main(char* file_to_open) { + #if defined(_WIN32) if (!SetProcessDPIAware()) // This function is only present in Windows versions higher than Vista. { @@ -525,6 +526,10 @@ milton_main(char* file_to_open) SDL_Init(SDL_INIT_VIDEO); milton_log("Done.\n"); + #ifdef __linux__ + gtk_init(NULL, NULL); + #endif + PlatformState platform_state = {}; PlatformPrefs prefs = {}; @@ -1059,5 +1064,3 @@ milton_main(char* file_to_open) return 0; } - -