Skip to content

Commit

Permalink
Fix nvidia crash: gtk_init must be called after SDL_Init so that XIni…
Browse files Browse the repository at this point in the history
…tThreads is the first Xlib function called.
  • Loading branch information
serge-rgb committed May 7, 2017
1 parent 441d3b3 commit 597c68c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/platform_unix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
7 changes: 5 additions & 2 deletions src/sdl_milton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
{
Expand All @@ -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 = {};
Expand Down Expand Up @@ -1059,5 +1064,3 @@ milton_main(char* file_to_open)

return 0;
}


0 comments on commit 597c68c

Please sign in to comment.