diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2013-01-01 14:56:17 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2013-01-01 14:56:17 +1100 |
commit | 787af434dbee95c96b68b0342213107ab3f9af2f (patch) | |
tree | d1b1c82558ed34ac1ea64b709e560ca3bb85055d | |
parent | d3a36ac23ec1ac9572584b6588e08bb11b57c091 (diff) | |
download | scintilla-mirror-787af434dbee95c96b68b0342213107ab3f9af2f.tar.gz |
Switch to non-deprecated thread and mutex APIs when using GLib >= 2.31.
-rw-r--r-- | gtk/PlatGTK.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
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 |