[svn-commits] rizzo: branch rizzo/astobj2 r47872 - /team/rizzo/astobj2/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 21 00:34:12 MST 2006


Author: rizzo
Date: Tue Nov 21 01:34:11 2006
New Revision: 47872

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47872
Log:
move destruction of some fields from pvt_destructor to __sip_destroy().
They cannot be triggered in the former because they hold references to
the pvt itself.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47872&r1=47871&r2=47872
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Tue Nov 21 01:34:11 2006
@@ -3144,26 +3144,6 @@
 		free_old_route(p->route);
 		p->route = NULL;
 	}
-	if (p->registry) {
-		/* XXX why this is only for ourselves ?
-		 * in any case, if it is for ourselves, the destructor
-		 * would not be called in astobj2
-		 */
-		if (p->registry->register_pvt == p)
-			p->registry->register_pvt = pvt_unref(p->registry->register_pvt);
-		unref_registry(p->registry);
-	}
-
-	/* Unlink us from the owner if we have one */
-	if (p->owner) { /* XXX never taken ? */
-		ast_verbose("pvt_destructor %p owner->tech_pvt %p\n",
-			p, p->owner->tech_pvt);
-		ast_channel_lock(p->owner);
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Detaching from %s\n", p->owner->name);
-		p->owner->tech_pvt = pvt_unref(p->owner->tech_pvt);	/* self pointer, basically */
-		ast_channel_unlock(p->owner);
-	}
 	/* Clear history */
 	if (p->history) {
 		struct sip_history *hist;
@@ -3200,6 +3180,26 @@
 			ast_sched_del(sched, cp->retransid);
 		cp->pvt = pvt_unref(cp->pvt);
 		free(cp);
+	}
+	if (p->registry) {
+		/* XXX why this is only for ourselves ?
+		 * in any case, if it is for ourselves, the destructor
+		 * would not be called in astobj2
+		 */
+		if (p->registry->register_pvt == p)
+			p->registry->register_pvt = pvt_unref(p->registry->register_pvt);
+		unref_registry(p->registry);
+	}
+
+	/* Unlink us from the owner if we have one */
+	if (p->owner) { /* XXX never taken ? */
+		ast_verbose("pvt_destructor %p owner->tech_pvt %p\n",
+			p, p->owner->tech_pvt);
+		ast_channel_lock(p->owner);
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Detaching from %s\n", p->owner->name);
+		p->owner->tech_pvt = pvt_unref(p->owner->tech_pvt);	/* self pointer, basically */
+		ast_channel_unlock(p->owner);
 	}
 #ifdef USE_AO2
 {	/* debugging */



More information about the svn-commits mailing list