aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2013-01-01 14:56:17 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2013-01-01 14:56:17 +1100
commit5c9a5f1e38b4a2353799542b1d53feb08d8161bb (patch)
tree80ec822fb50dad5472841fd9d3501d84bffaa767
parente17f73fca0ac5d7ab1a26f92a3b68a9429925e15 (diff)
downloadscintilla-mirror-5c9a5f1e38b4a2353799542b1d53feb08d8161bb.tar.gz
Switch to non-deprecated thread and mutex APIs when using GLib >= 2.31.
-rw-r--r--gtk/PlatGTK.cxx12
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