[asterisk-commits] dlee: branch dlee/stasis-app r381830 - in /team/dlee/stasis-app: ./ main/ tests/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 20 11:48:40 CST 2013
Author: dlee
Date: Wed Feb 20 11:48:37 2013
New Revision: 381830
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381830
Log:
Clean up destruction order bug
........
Merged revisions 381829 from http://svn.asterisk.org/svn/asterisk/team/dlee/stasis-core
Modified:
team/dlee/stasis-app/ (props changed)
team/dlee/stasis-app/main/stasis.c
team/dlee/stasis-app/tests/test_stasis.c
Propchange: team/dlee/stasis-app/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 20 11:48:37 2013
@@ -1,1 +1,1 @@
-/team/dlee/stasis-core:1-381811
+/team/dlee/stasis-core:1-381829
Modified: team/dlee/stasis-app/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis.c?view=diff&rev=381830&r1=381829&r2=381830
==============================================================================
--- team/dlee/stasis-app/main/stasis.c (original)
+++ team/dlee/stasis-app/main/stasis.c Wed Feb 20 11:48:37 2013
@@ -169,12 +169,12 @@
void stasis_unsubscribe(struct stasis_subscription *sub)
{
- size_t i;
-
if (sub) {
+ RAII_VAR(struct stasis_subscription *, cleanup_after_unlock, NULL, ao2_cleanup);
SCOPED_AO2LOCK(lock, sub);
if (sub->topic) {
+ size_t i;
struct stasis_topic *topic = sub->topic;
SCOPED_AO2LOCK(lock, topic);
@@ -183,7 +183,8 @@
sub->topic = NULL;
/* swap [i] with last entry; remove last entry */
topic->subscribers[i] = topic->subscribers[--topic->num_subscribers_current];
- ao2_cleanup(sub);
+ /* We can't clean up now, since the lock is held. defer to RAII */
+ cleanup_after_unlock = sub;
return;
}
}
Modified: team/dlee/stasis-app/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/tests/test_stasis.c?view=diff&rev=381830&r1=381829&r2=381830
==============================================================================
--- team/dlee/stasis-app/tests/test_stasis.c (original)
+++ team/dlee/stasis-app/tests/test_stasis.c Wed Feb 20 11:48:37 2013
@@ -406,9 +406,9 @@
RAII_VAR(struct stasis_message_type *, non_cache_type, NULL, ao2_cleanup);
RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
RAII_VAR(struct stasis_caching_topic *, caching_topic, NULL, ao2_cleanup);
+ RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
RAII_VAR(struct stasis_subscription *, sub, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, test_message, NULL, ao2_cleanup);
- RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
int actual_len;
struct stasis_message_type *actual_type;
More information about the asterisk-commits
mailing list