[gcr] Fix build for glib 2.31 deprecations
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] Fix build for glib 2.31 deprecations
- Date: Tue, 6 Dec 2011 14:56:28 +0000 (UTC)
commit 05229c49db4159fb909d4f70a3d2d4cc930b3a90
Author: Stef Walter <stefw collabora co uk>
Date: Tue Dec 6 15:43:32 2011 +0100
Fix build for glib 2.31 deprecations
* Mainly g_mutex_new/g_mutex_free g_cond_new/g_cond_free
* Since we like to build with the last stable version of glib,
using #ifdef until these glib changes make it into a stable release.
build/glib.supp | 27 ++++++++++++++++++++++++++-
build/unknown.supp | 36 ++++++++++++++++++++++++++++++++++++
egg/egg-libgcrypt.c | 10 ++++++++++
gck/gck-enumerator.c | 10 ++++++++++
gck/gck-session.c | 10 ++++++++++
gcr/gcr-importer.c | 14 ++++++++++++++
6 files changed, 106 insertions(+), 1 deletions(-)
---
diff --git a/build/glib.supp b/build/glib.supp
index 5fd86ba..194b1e8 100644
--- a/build/glib.supp
+++ b/build/glib.supp
@@ -378,7 +378,6 @@
g_child_watch_source_new
Memcheck:Leak
...
- fun:g_thread_create_full
fun:ensure_unix_signal_handler_installed_unlocked
fun:g_child_watch_source_new
}
@@ -392,3 +391,29 @@
fun:g_async_queue_timed_pop
fun:g_thread_pool_thread_proxy
}
+{
+ g_module_open
+ Memcheck:Leak
+ ...
+ fun:g_private_impl_new
+ ...
+ fun:g_module_open
+}
+{
+ g_system_thread_new
+ Memcheck:Leak
+ ...
+ fun:g_system_thread_new
+}
+{
+ thread_memory_from_self
+ Memcheck:Leak
+ ...
+ fun:thread_memory_from_self
+}
+{
+ g_get_language_names
+ Memcheck:Leak
+ ...
+ fun:g_get_language_names
+}
diff --git a/build/unknown.supp b/build/unknown.supp
index b31210d..bc7eea1 100644
--- a/build/unknown.supp
+++ b/build/unknown.supp
@@ -382,3 +382,39 @@
fun:g_thread_pool_start_thread
fun:g_thread_pool_push
}
+{
+ thread_memory_from_self
+ Memcheck:Leak
+ ...
+ fun:thread_memory_from_self
+ ...
+ fun:g_object_new
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+ fun:get_dispatch
+ fun:g_main_dispatch
+ fun:g_main_context_dispatch
+ fun:g_main_context_iterate
+ fun:g_main_loop_run
+}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:standard_malloc
+ fun:g_malloc
+ fun:g_memdup
+ fun:g_hash_table_insert_node
+ fun:g_hash_table_insert_internal
+ fun:g_hash_table_insert
+ fun:handler_list_ensure
+ fun:handler_insert
+ fun:g_signal_connect_data
+}
diff --git a/egg/egg-libgcrypt.c b/egg/egg-libgcrypt.c
index bf68746..b86447c 100644
--- a/egg/egg-libgcrypt.c
+++ b/egg/egg-libgcrypt.c
@@ -56,14 +56,24 @@ fatal_handler (gpointer unused, int unknown, const gchar *msg)
static int
glib_thread_mutex_init (void **lock)
{
+#if GLIB_CHECK_VERSION(2,31,3)
+ *lock = g_new0 (GMutex, 1);
+ g_mutex_init (*lock);
+#else
*lock = g_mutex_new ();
+#endif
return 0;
}
static int
glib_thread_mutex_destroy (void **lock)
{
+#if GLIB_CHECK_VERSION(2,31,3)
+ g_mutex_clear (*lock);
+ g_free (*lock);
+#else
g_mutex_free (*lock);
+#endif
return 0;
}
diff --git a/gck/gck-enumerator.c b/gck/gck-enumerator.c
index 5ebec47..68dca60 100644
--- a/gck/gck-enumerator.c
+++ b/gck/gck-enumerator.c
@@ -566,7 +566,12 @@ static void
gck_enumerator_init (GckEnumerator *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_ENUMERATOR, GckEnumeratorPrivate);
+#if GLIB_CHECK_VERSION(2,31,2)
+ self->pv->mutex = g_new0 (GMutex, 1);
+ g_mutex_init (self->pv->mutex);
+#else
self->pv->mutex = g_mutex_new ();
+#endif
self->pv->the_state = g_new0 (GckEnumeratorState, 1);
self->pv->object_type = GCK_TYPE_OBJECT;
self->pv->object_class = g_type_class_ref (self->pv->object_type);
@@ -643,7 +648,12 @@ gck_enumerator_finalize (GObject *obj)
cleanup_state (self->pv->the_state);
g_free (self->pv->the_state);
+#if GLIB_CHECK_VERSION(2,31,2)
+ g_mutex_clear (self->pv->mutex);
+ g_free (self->pv->mutex);
+#else
g_mutex_free (self->pv->mutex);
+#endif
g_type_class_unref (self->pv->object_class);
G_OBJECT_CLASS (gck_enumerator_parent_class)->finalize (obj);
diff --git a/gck/gck-session.c b/gck/gck-session.c
index 50681bb..6d3fcb6 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -141,7 +141,12 @@ static void
gck_session_init (GckSession *self)
{
self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCK_TYPE_SESSION, GckSessionPrivate);
+#if GLIB_CHECK_VERSION(2,31,2)
+ self->pv->mutex = g_new0 (GMutex, 1);
+ g_mutex_init (self->pv->mutex);
+#else
self->pv->mutex = g_mutex_new ();
+#endif
}
static void
@@ -260,7 +265,12 @@ gck_session_finalize (GObject *obj)
g_clear_object (&self->pv->interaction);
g_clear_object (&self->pv->slot);
+#if GLIB_CHECK_VERSION(2,31,2)
+ g_mutex_clear (self->pv->mutex);
+ g_free (self->pv->mutex);
+#else
g_mutex_free (self->pv->mutex);
+#endif
G_OBJECT_CLASS (gck_session_parent_class)->finalize (obj);
}
diff --git a/gcr/gcr-importer.c b/gcr/gcr-importer.c
index 0eaa816..cb35c5c 100644
--- a/gcr/gcr-importer.c
+++ b/gcr/gcr-importer.c
@@ -390,8 +390,15 @@ gcr_importer_import (GcrImporter *importer,
g_return_val_if_fail (iface->import_finish != NULL, FALSE);
closure = g_new0 (ImportClosure, 1);
+#if GLIB_CHECK_VERSION(2,31,2)
+ closure->cond = g_new (GCond, 1);
+ g_cond_init (closure->cond);
+ closure->mutex = g_new (GMutex, 1);
+ g_mutex_init (closure->mutex);
+#else
closure->cond = g_cond_new ();
closure->mutex = g_mutex_new ();
+#endif
closure->context = g_main_context_get_thread_default ();
g_mutex_lock (closure->mutex);
@@ -426,8 +433,15 @@ gcr_importer_import (GcrImporter *importer,
if (closure->error)
g_propagate_error (error, closure->error);
+#if GLIB_CHECK_VERSION(2,31,2)
+ g_cond_clear (closure->cond);
+ g_free (closure->cond);
+ g_mutex_clear (closure->mutex);
+ g_free (closure->mutex);
+#else
g_cond_free (closure->cond);
g_mutex_free (closure->mutex);
+#endif
g_free (closure);
return result;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]