summaryrefslogtreecommitdiffstats
path: root/devel/glib20
diff options
context:
space:
mode:
authorjylefort <jylefort@df743ca5-7f9a-e211-a948-0013205c9059>2005-07-21 02:34:26 +0800
committerjylefort <jylefort@df743ca5-7f9a-e211-a948-0013205c9059>2005-07-21 02:34:26 +0800
commit0443c3069de169ddd43a0cccad8999a2a4705155 (patch)
tree705ae39b2bb478b808202d01e64d69a7e7bb0778 /devel/glib20
parent5d9ffad485d9fa79c284b3cdb4d45f9c52b86a16 (diff)
downloadmarcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar.gz
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar.bz2
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar.lz
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar.xz
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.tar.zst
marcuscom-ports-0443c3069de169ddd43a0cccad8999a2a4705155.zip
Fix memory leaks when G_ERRORCHECK_MUTEXES is used:
http://bugzilla.gnome.org/show_bug.cgi?id=311043 git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@4280 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel/glib20')
-rw-r--r--devel/glib20/Makefile3
-rw-r--r--devel/glib20/files/patch-glib_gthread.c28
-rw-r--r--devel/glib20/files/patch-glib_gthreadprivate.h53
-rw-r--r--devel/glib20/files/patch-gthread_gthread-impl.c185
4 files changed, 268 insertions, 1 deletions
diff --git a/devel/glib20/Makefile b/devel/glib20/Makefile
index 634ffb8ff..950da9dce 100644
--- a/devel/glib20/Makefile
+++ b/devel/glib20/Makefile
@@ -3,11 +3,12 @@
# Whom: Vanilla I. Shu <vanilla@FreeBSD.org>
#
# $FreeBSD$
-# $MCom: ports/devel/glib20/Makefile,v 1.43 2005/07/08 18:25:23 ahze Exp $
+# $MCom: ports/devel/glib20/Makefile,v 1.44 2005/07/15 23:10:32 marcus Exp $
#
PORTNAME= glib
PORTVERSION= 2.7.3
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNOME:S,%SUBDIR%,sources/${PORTNAME}/2.7,} \
ftp://ftp.gtk.org/pub/gtk/v2.7/ \
diff --git a/devel/glib20/files/patch-glib_gthread.c b/devel/glib20/files/patch-glib_gthread.c
new file mode 100644
index 000000000..1dce08388
--- /dev/null
+++ b/devel/glib20/files/patch-glib_gthread.c
@@ -0,0 +1,28 @@
+--- glib/gthread.c.orig Mon Mar 14 05:02:07 2005
++++ glib/gthread.c Wed Jul 20 19:44:08 2005
+@@ -42,24 +42,8 @@
+
+ #include "glib.h"
+ #include "gthreadinit.h"
++#include "gthreadprivate.h"
+ #include "galias.h"
+-
+-#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
+-# define g_system_thread_equal_simple(thread1, thread2) \
+- ((thread1).dummy_pointer == (thread2).dummy_pointer)
+-# define g_system_thread_assign(dest, src) \
+- ((dest).dummy_pointer = (src).dummy_pointer)
+-#else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */
+-# define g_system_thread_equal_simple(thread1, thread2) \
+- (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0)
+-# define g_system_thread_assign(dest, src) \
+- (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD))
+-#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
+-
+-#define g_system_thread_equal(thread1, thread2) \
+- (g_thread_functions_for_glib_use.thread_equal ? \
+- g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\
+- g_system_thread_equal_simple((thread1), (thread2)))
+
+ GQuark
+ g_thread_error_quark (void)
diff --git a/devel/glib20/files/patch-glib_gthreadprivate.h b/devel/glib20/files/patch-glib_gthreadprivate.h
new file mode 100644
index 000000000..0235c2026
--- /dev/null
+++ b/devel/glib20/files/patch-glib_gthreadprivate.h
@@ -0,0 +1,53 @@
+--- glib/gthreadprivate.h.orig Wed Jul 20 19:44:08 2005
++++ glib/gthreadprivate.h Wed Jul 20 19:44:08 2005
+@@ -0,0 +1,50 @@
++/* gthreadprivate.h
++ *
++ * Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
++ * Owen Taylor
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++#ifndef __G_THREAD_PRIVATE_H__
++#define __G_THREAD_PRIVATE_H__
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++G_BEGIN_DECLS
++
++#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
++# define g_system_thread_equal_simple(thread1, thread2) \
++ ((thread1).dummy_pointer == (thread2).dummy_pointer)
++# define g_system_thread_assign(dest, src) \
++ ((dest).dummy_pointer = (src).dummy_pointer)
++#else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */
++# define g_system_thread_equal_simple(thread1, thread2) \
++ (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0)
++# define g_system_thread_assign(dest, src) \
++ (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD))
++#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
++
++#define g_system_thread_equal(thread1, thread2) \
++ (g_thread_functions_for_glib_use.thread_equal ? \
++ g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\
++ g_system_thread_equal_simple((thread1), (thread2)))
++
++G_END_DECLS
++
++#endif /* __G_THREAD_PRIVATE_H__ */
diff --git a/devel/glib20/files/patch-gthread_gthread-impl.c b/devel/glib20/files/patch-gthread_gthread-impl.c
new file mode 100644
index 000000000..5f1b6dcbd
--- /dev/null
+++ b/devel/glib20/files/patch-gthread_gthread-impl.c
@@ -0,0 +1,185 @@
+--- gthread/gthread-impl.c.orig Fri Feb 14 16:08:46 2003
++++ gthread/gthread-impl.c Wed Jul 20 19:44:08 2005
+@@ -37,9 +37,11 @@
+
+ #include <glib.h>
+ #include <gthreadinit.h>
++#include "gthreadprivate.h"
+
+ #ifdef G_THREADS_ENABLED
+
++static GSystemThread zero_thread; /* This is initialized to all zero */
+ static gboolean thread_system_already_initialized = FALSE;
+ static gint g_thread_priority_map [G_THREAD_PRIORITY_URGENT + 1];
+
+@@ -76,7 +78,7 @@
+ struct _ErrorCheckInfo
+ {
+ gchar *location;
+- GThread *owner;
++ GSystemThread owner;
+ };
+
+ static GMutex *
+@@ -94,7 +96,9 @@
+ gchar *location)
+ {
+ ErrorCheckInfo *info;
+- GThread *self = g_thread_self ();
++ GSystemThread self;
++
++ g_thread_functions_for_glib_use.thread_self (&self);
+
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+@@ -116,14 +120,14 @@
+ }
+
+ info = G_MUTEX_DEBUG_INFO (mutex);
+- if (info->owner == self)
++ if (g_system_thread_equal (info->owner, self))
+ g_error ("Trying to recursivly lock a mutex at '%s', "
+ "previously locked at '%s'",
+ location, info->location);
+
+ g_thread_functions_for_glib_use_default.mutex_lock (mutex);
+
+- info->owner = self;
++ g_system_thread_assign (info->owner, self);
+ info->location = location;
+ }
+
+@@ -133,7 +137,9 @@
+ gchar *location)
+ {
+ ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
+- GThread *self = g_thread_self ();
++ GSystemThread self;
++
++ g_thread_functions_for_glib_use.thread_self (&self);
+
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+@@ -145,7 +151,7 @@
+ return TRUE;
+ }
+
+- if (info->owner == self)
++ if (g_system_thread_equal (info->owner, self))
+ g_error ("Trying to recursivly lock a mutex at '%s', "
+ "previously locked at '%s'",
+ location, info->location);
+@@ -153,7 +159,7 @@
+ if (!g_thread_functions_for_glib_use_default.mutex_trylock (mutex))
+ return FALSE;
+
+- info->owner = self;
++ g_system_thread_assign (info->owner, self);
+ info->location = location;
+
+ return TRUE;
+@@ -165,20 +171,22 @@
+ gchar *location)
+ {
+ ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
+- GThread *self = g_thread_self ();
++ GSystemThread self;
++
++ g_thread_functions_for_glib_use.thread_self (&self);
+
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+
+- if (!info || info->owner == NULL)
++ if (!info || g_system_thread_equal (info->owner, zero_thread))
+ g_error ("Trying to unlock an unlocked mutex at '%s'", location);
+
+- if (info->owner != self)
++ if (!g_system_thread_equal (info->owner, self))
+ g_warning ("Trying to unlock a mutex at '%s', "
+ "previously locked by a different thread at '%s'",
+ location, info->location);
+
+- info->owner = NULL;
++ g_system_thread_assign (info->owner, zero_thread);
+ info->location = NULL;
+
+ g_thread_functions_for_glib_use_default.mutex_unlock (mutex);
+@@ -194,7 +202,7 @@
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+
+- if (info && info->owner != NULL)
++ if (info && !g_system_thread_equal (info->owner, zero_thread))
+ g_error ("Trying to free a locked mutex at '%s', "
+ "which was previously locked at '%s'",
+ location, info->location);
+@@ -211,25 +219,27 @@
+ {
+
+ ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
+- GThread *self = g_thread_self ();
++ GSystemThread self;
++
++ g_thread_functions_for_glib_use.thread_self (&self);
+
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+
+- if (!info || info->owner == NULL)
++ if (!info || g_system_thread_equal (info->owner, zero_thread))
+ g_error ("Trying to use an unlocked mutex in g_cond_wait() at '%s'",
+ location);
+
+- if (info->owner != self)
++ if (!g_system_thread_equal (info->owner, self))
+ g_error ("Trying to use a mutex locked by another thread in "
+ "g_cond_wait() at '%s'", location);
+
+- info->owner = NULL;
++ g_system_thread_assign (info->owner, zero_thread);
+ location = info->location;
+
+ g_thread_functions_for_glib_use_default.cond_wait (cond, mutex);
+
+- info->owner = self;
++ g_system_thread_assign (info->owner, self);
+ info->location = location;
+ }
+
+@@ -242,28 +252,30 @@
+ gchar *location)
+ {
+ ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
+- GThread *self = g_thread_self ();
++ GSystemThread self;
+ gboolean retval;
+
++ g_thread_functions_for_glib_use.thread_self (&self);
++
+ if (magic != G_MUTEX_DEBUG_MAGIC)
+ location = "unknown";
+
+- if (!info || info->owner == NULL)
++ if (!info || g_system_thread_equal (info->owner, zero_thread))
+ g_error ("Trying to use an unlocked mutex in g_cond_timed_wait() at '%s'",
+ location);
+
+- if (info->owner != self)
++ if (!g_system_thread_equal (info->owner, self))
+ g_error ("Trying to use a mutex locked by another thread in "
+ "g_cond_timed_wait() at '%s'", location);
+
+- info->owner = NULL;
++ g_system_thread_assign (info->owner, zero_thread);
+ location = info->location;
+
+ retval = g_thread_functions_for_glib_use_default.cond_timed_wait (cond,
+ mutex,
+ end_time);
+
+- info->owner = self;
++ g_system_thread_assign (info->owner, self);
+ info->location = location;
+
+ return retval;