From f814164de2b9fc83bef53b4b2818e0f9c5354e3b Mon Sep 17 00:00:00 2001 From: Per Allard Date: Mon, 30 Dec 2019 21:56:43 +0100 Subject: [PATCH] Issue: can't compile on Arch Linux #304 The build failure(s) come from the fact that the posix frontends currently use deprecated functions for multi-threading. The offending functions are: g_thread_create and g_thread_supported, both deprecated since 2.32. g_thread_create is replaced by g_thread_new and g_thread_supported is no longer needed at all for glib >= 2.32 threading is automatically initialized when the program starts. --- desmume/src/frontend/posix/cli/main.cpp | 4 ---- desmume/src/frontend/posix/gtk-glade/main.cpp | 10 ++-------- desmume/src/frontend/posix/gtk/main.cpp | 11 +++-------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/desmume/src/frontend/posix/cli/main.cpp b/desmume/src/frontend/posix/cli/main.cpp index 32455d9af..c8c12578b 100644 --- a/desmume/src/frontend/posix/cli/main.cpp +++ b/desmume/src/frontend/posix/cli/main.cpp @@ -568,10 +568,6 @@ int main(int argc, char ** argv) { slot2_Init(); slot2_Change((NDS_SLOT2_TYPE)slot2_device_type); -#if !g_thread_supported() - g_thread_init( NULL); -#endif - driver = new BaseDriver(); #ifdef GDB_STUB diff --git a/desmume/src/frontend/posix/gtk-glade/main.cpp b/desmume/src/frontend/posix/gtk-glade/main.cpp index b10fd1aec..c23b3c636 100755 --- a/desmume/src/frontend/posix/gtk-glade/main.cpp +++ b/desmume/src/frontend/posix/gtk-glade/main.cpp @@ -334,10 +334,8 @@ gchar * get_ui_file (const char *filename) void * createThread_gdb( void (*thread_function)( void *data), void *thread_data) { - GThread *new_thread = g_thread_create( (GThreadFunc)thread_function, - thread_data, - TRUE, - NULL); + GThread *new_thread = g_thread_new(NULL, (GThreadFunc)thread_function, + thread_data); return new_thread; } @@ -531,10 +529,6 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Warning: X11 not thread-safe\n"); } -#if !g_thread_supported() - g_thread_init( NULL); -#endif - gtk_init(&argc, &argv); #ifdef GTKGLEXT_AVAILABLE diff --git a/desmume/src/frontend/posix/gtk/main.cpp b/desmume/src/frontend/posix/gtk/main.cpp index f95a55bb9..bdcf3555a 100644 --- a/desmume/src/frontend/posix/gtk/main.cpp +++ b/desmume/src/frontend/posix/gtk/main.cpp @@ -789,10 +789,9 @@ void * createThread_gdb( void (*thread_function)( void *data), void *thread_data) { - GThread *new_thread = g_thread_create( (GThreadFunc)thread_function, - thread_data, - TRUE, - NULL); + GThread *new_thread = g_thread_new(NULL, + (GThreadFunc)thread_function, + thread_data); return new_thread; } @@ -3612,10 +3611,6 @@ int main (int argc, char *argv[]) fprintf(stderr, "Warning: X11 not thread-safe\n"); } -#if !g_thread_supported() - g_thread_init( NULL); -#endif - gtk_init(&argc, &argv); if ( !fill_configured_features( &my_config, argv)) {