[asterisk-commits] russell: branch 1.6.1 r152900 - in /branches/1.6.1: ./ include/asterisk/sched.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 30 14:31:41 CDT 2008


Author: russell
Date: Thu Oct 30 14:31:40 2008
New Revision: 152900

URL: http://svn.digium.com/view/asterisk?view=rev&rev=152900
Log:
Merged revisions 152887 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r152887 | russell | 2008-10-30 14:28:06 -0500 (Thu, 30 Oct 2008) | 7 lines

Fix a bug in AST_SCHED_REPLACE_UNREF().  The reference count of the object
_must_ be increased before creating the scheduler entry.  Otherwise, you
create a race condition where the reference count may hit zero and the
object can disappear out from under you.  This could also would have
incorrectly decreased the reference count in the case that the scheduler
add failed.

........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/include/asterisk/sched.h

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/include/asterisk/sched.h?view=diff&rev=152900&r1=152899&r2=152900
==============================================================================
--- branches/1.6.1/include/asterisk/sched.h (original)
+++ branches/1.6.1/include/asterisk/sched.h Thu Oct 30 14:31:40 2008
@@ -113,11 +113,10 @@
 			unrefcall;	/* should ref _data! */		\
 		if (_count == 10) \
 			ast_log(LOG_WARNING, "Unable to cancel schedule ID %d.  This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
+		refcall; \
 		id = ast_sched_add_variable(sched, when, callback, data, variable); \
 		if (id == -1)  \
 			addfailcall;	\
-		else \
-			refcall; \
 	} while (0);
 
 #define AST_SCHED_REPLACE_UNREF(id, sched, when, callback, data, unrefcall, addfailcall, refcall) \




More information about the asterisk-commits mailing list