diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-05 01:59:32 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-05 01:59:32 +0000 |
commit | 2e316c898ea4619a5485e77b5c255cce6ad3f8c1 (patch) | |
tree | 183530632cf53a387dfb5cfcf866f6c833b0fd0f /include/asterisk/lock.h | |
parent | 75f71be83866977c0d8a0ef7082cb98f3b3cb346 (diff) |
Merged revisions 91070 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r91070 | russell | 2007-12-04 18:35:31 -0600 (Tue, 04 Dec 2007) | 11 lines
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)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@91114 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/lock.h')
-rw-r--r-- | include/asterisk/lock.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 5f243915f..c9f4b4eae 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -1115,12 +1115,12 @@ AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), #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__) || defined(__x86_64__) #ifdef sun AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v), |