[asterisk-commits] russell: branch 1.4 r91070 - /branches/1.4/include/asterisk/lock.h
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 4 18:35:32 CST 2007
Author: russell
Date: Tue Dec 4 18:35:31 2007
New Revision: 91070
URL: http://svn.digium.com/view/asterisk?view=rev&rev=91070
Log:
Fix some crashes in chan_iax2 that were reported as happening on Mac systems.
It turns out that the problem was the Mac version of the ast_atomic_fetchadd_int()
function. The Mac atomic add function returns the _new_ value, while this function
is supposed to return the old value. So, the crashes happened on unreferencing
objects. If the reference count was decreased to 1, ao2_ref() thought that it
had been decreased to zero, and called the destructor. However, there was still
an outstanding reference around.
(closes issue #11176)
(closes issue #11289)
Modified:
branches/1.4/include/asterisk/lock.h
Modified: branches/1.4/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/lock.h?view=diff&rev=91070&r1=91069&r2=91070
==============================================================================
--- branches/1.4/include/asterisk/lock.h (original)
+++ branches/1.4/include/asterisk/lock.h Tue Dec 4 18:35:31 2007
@@ -1104,12 +1104,12 @@
#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
{
- return OSAtomicAdd32(v, (int32_t *) p);
+ return OSAtomicAdd32(v, (int32_t *) p) - v;
})
#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
{
- return OSAtomicAdd64(v, (int64_t *) p);
+ return OSAtomicAdd64(v, (int64_t *) p) - v;
#elif defined (__i386__)
#ifdef sun
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
More information about the asterisk-commits
mailing list