[asterisk-commits] murf: branch murf/bug11210 r113981 - /team/murf/bug11210/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 9 17:33:32 CDT 2008


Author: murf
Date: Wed Apr  9 17:33:32 2008
New Revision: 113981

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113981
Log:
inadvertently left out the **destructor** line in the /tmp/refs astobj2 refcount trace... refcounter really needs this. Put it back in.

Modified:
    team/murf/bug11210/main/astobj2.c

Modified: team/murf/bug11210/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/astobj2.c?view=diff&rev=113981&r1=113980&r2=113981
==============================================================================
--- team/murf/bug11210/main/astobj2.c (original)
+++ team/murf/bug11210/main/astobj2.c Wed Apr  9 17:33:32 2008
@@ -204,8 +204,12 @@
 		fprintf(refo, "%p %s%d   %s:%d:%s (%s) [@%d]\n", user_data, (delta<0? "":"+"), delta, file, line, funcname, tag, obj->priv_data.ref_counter);
 		fclose(refo);
 	}
+	if (obj->priv_data.ref_counter + delta == 0 && obj->priv_data.destructor_fn != NULL) { /* this isn't protected with lock; just for o/p */
+			FILE *refo = fopen(REF_FILE,"a"); 	 
+			fprintf(refo, "%p **call destructor** %s:%d:%s (%s)\n", user_data, file, line, funcname, tag); 	 
+			fclose(refo);
+	}
 	return __ao2_ref(user_data, delta);
-	
 }
 
 int _ao2_ref(void *user_data, const int delta)
@@ -241,8 +245,9 @@
 		ast_log(LOG_ERROR, "refcount %d on object %p\n", current_value, user_data);
 
 	if (current_value <= 0) { /* last reference, destroy the object */
-		if (obj->priv_data.destructor_fn != NULL) 
+		if (obj->priv_data.destructor_fn != NULL) {
 			obj->priv_data.destructor_fn(user_data);
+		}
 
 		ast_mutex_destroy(&obj->priv_data.lock);
 #ifdef AO2_DEBUG




More information about the asterisk-commits mailing list