From 5c9a5f1e38b4a2353799542b1d53feb08d8161bb Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Tue, 1 Jan 2013 14:56:17 +1100 Subject: Switch to non-deprecated thread and mutex APIs when using GLib >= 2.31. --- gtk/PlatGTK.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 91fafcc9b..3aec7a6ab 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -105,9 +105,11 @@ struct LOGFONT { static GMutex *fontMutex = NULL; static void InitializeGLIBThreads() { +#if !GLIB_CHECK_VERSION(2,31,0) if (!g_thread_supported()) { g_thread_init(NULL); } +#endif } #endif @@ -115,7 +117,12 @@ static void FontMutexAllocate() { #if USE_LOCK if (!fontMutex) { InitializeGLIBThreads(); +#if GLIB_CHECK_VERSION(2,31,0) + fontMutex = g_new(GMutex, 1); + g_mutex_init(fontMutex); +#else fontMutex = g_mutex_new(); +#endif } #endif } @@ -123,7 +130,12 @@ static void FontMutexAllocate() { static void FontMutexFree() { #if USE_LOCK if (fontMutex) { +#if GLIB_CHECK_VERSION(2,31,0) + g_mutex_clear(fontMutex); + g_free(fontMutex); +#else g_mutex_free(fontMutex); +#endif fontMutex = NULL; } #endif -- cgit v1.2.3