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
This commit is contained in:
parent
f66c41e668
commit
5a1f2a5884
|
@ -612,6 +612,8 @@ void *__ao2_weakproxy_get_object(void *weakproxy, int flags,
|
||||||
* \retval 0 Success
|
* \retval 0 Success
|
||||||
* \retval -1 Failure
|
* \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
|
* \note This procedure will allow the same cb / data pair to be added to
|
||||||
* the same weakproxy multiple times.
|
* the same weakproxy multiple times.
|
||||||
*
|
*
|
||||||
|
|
|
@ -928,7 +928,7 @@ int ao2_weakproxy_subscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, v
|
||||||
if (sub) {
|
if (sub) {
|
||||||
sub->cb = cb;
|
sub->cb = cb;
|
||||||
sub->data = data;
|
sub->data = data;
|
||||||
AST_LIST_INSERT_TAIL(&weak->destroyed_cb, sub, list);
|
AST_LIST_INSERT_HEAD(&weak->destroyed_cb, sub, list);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue