[asterisk-commits] Astobj2: Run weakproxy subscription callbacks in reverse order. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun May 24 10:48:47 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: Astobj2: Run weakproxy subscription callbacks in reverse order.
......................................................................


Astobj2: Run weakproxy subscription callbacks in reverse order.

Modify ao2_weakproxy_subscribe so each new subscription is added
to the head of the list.  This ensures that when other objects
are allocated and use a subscription to the weakproxy for cleanup,
cleanup will occur in the correct order.

ASTERISK-25120 #close

Change-Id: Ie0476f08ec21330de1b3f5a2dd3d9eb683df3d3d
---
M include/asterisk/astobj2.h
M main/astobj2.c
2 files changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index e02a4cd..4a7aeee 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -612,6 +612,8 @@
  * \retval 0 Success
  * \retval -1 Failure
  *
+ * \note Callbacks are run in the reverse order of subscriptions.
+ *
  * \note This procedure will allow the same cb / data pair to be added to
  *       the same weakproxy multiple times.
  *
diff --git a/main/astobj2.c b/main/astobj2.c
index 1db2dd4..ed91577 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -928,7 +928,7 @@
 		if (sub) {
 			sub->cb = cb;
 			sub->data = data;
-			AST_LIST_INSERT_TAIL(&weak->destroyed_cb, sub, list);
+			AST_LIST_INSERT_HEAD(&weak->destroyed_cb, sub, list);
 			ret = 0;
 		}
 	} else {

-- 
To view, visit https://gerrit.asterisk.org/525
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0476f08ec21330de1b3f5a2dd3d9eb683df3d3d
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list