--- a/libpurple/network.c Thu Apr 18 00:12:59 2013 +0200
+++ b/libpurple/network.c Thu Apr 18 01:50:30 2013 +0200
@@ -85,7 +85,12 @@
static int current_network_count;
/* Mutex for the other global vars */
+#if GLIB_CHECK_VERSION(2, 32, 0) static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static gboolean network_initialized = FALSE;
static HANDLE network_change_handle = NULL;
static int (WSAAPI *MyWSANSPIoctl) (
@@ -700,11 +705,19 @@
WSACOMPLETION completion;
WSAOVERLAPPED overlapped;
+#if GLIB_CHECK_VERSION(2, 32, 0) g_static_mutex_lock(&mutex);
if (network_initialized == FALSE) {
/* purple_network_uninit has been called */
WSACloseEvent(nla_event);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
@@ -722,13 +735,21 @@
WSACloseEvent(nla_event);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
memset(&completion, 0, sizeof(WSACOMPLETION));
completion.Type = NSP_NOTIFY_EVENT;
overlapped.hEvent = nla_event;
@@ -739,10 +760,18 @@
if (errorid == WSA_INVALID_HANDLE) {
purple_timeout_add(0, _print_debug_msg,
g_strdup("Invalid NLA handle; resetting.\n"));
+#if GLIB_CHECK_VERSION(2, 32, 0) g_static_mutex_lock(&mutex);
retval = WSALookupServiceEnd(network_change_handle);
network_change_handle = NULL;
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
/* WSA_IO_PENDING indicates successful async notification will happen */
} else if (errorid != WSA_IO_PENDING) {
@@ -764,11 +793,19 @@
last_trigger = time(NULL);
+#if GLIB_CHECK_VERSION(2, 32, 0) g_static_mutex_lock(&mutex);
if (network_initialized == FALSE) {
WSACloseEvent(nla_event);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
@@ -782,7 +819,11 @@
WSAResetEvent(nla_event);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
purple_timeout_add(0, wpurple_network_change_thread_cb, NULL);
@@ -1214,7 +1255,11 @@
+#if GLIB_CHECK_VERSION(2, 32, 0) g_static_mutex_lock(&mutex);
network_initialized = FALSE;
if (network_change_handle != NULL) {
@@ -1231,7 +1276,11 @@
network_change_handle = NULL;
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_mutex_unlock(&mutex); g_static_mutex_unlock(&mutex);
purple_signal_unregister(purple_network_get_handle(),
--- a/libpurple/util.c Thu Apr 18 00:12:59 2013 +0200
+++ b/libpurple/util.c Thu Apr 18 01:50:30 2013 +0200
@@ -4328,7 +4328,11 @@
purple_gai_strerror(gint errnum)
+#if GLIB_CHECK_VERSION(2, 32, 0) + static GPrivate msg_private = G_PRIVATE_INIT(g_free); static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
@@ -4356,11 +4360,19 @@
+#if GLIB_CHECK_VERSION(2, 32, 0) + msg = g_private_get(&msg_private); msg = g_static_private_get(&msg_private);
+#if GLIB_CHECK_VERSION(2, 32, 0) + g_private_set(&msg_private, msg); g_static_private_set(&msg_private, msg, g_free);
sprintf(msg, "unknown error (%d)", errnum);