diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-09 14:57:39 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-09 14:57:39 +0000 |
commit | e6e217d5e1b52a155a4cc1950ba30bf682ef7a11 (patch) | |
tree | b60ec628e0e90a21df375ad588a88c10916f96c8 /main | |
parent | cf6cd2d414de9e85060ea08d9ad643e00d30b5c3 (diff) |
Merged revisions 161948 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r161948 | russell | 2008-12-09 08:52:25 -0600 (Tue, 09 Dec 2008) | 15 lines
Fix a problem with GROUP() settings on a masquerade.
The previous code carried over group settings from the old channel to the new
one. However, it did nothing with the group settings that were already on the
new channel. This patch removes all group settings that already existed on the
new channel.
I have a more complicated version of this patch which addresses only the most
blatant problem with this, which is that a channel can end up with multiple
group settings in the same category. However, I could not think of a use case
for keeping any of the group settings from the old channel, so I went this route
for now.
(closes AST-152)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@161951 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/app.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/main/app.c b/main/app.c index 2d1b897fb..aecbffaf2 100644 --- a/main/app.c +++ b/main/app.c @@ -1010,10 +1010,15 @@ int ast_app_group_update(struct ast_channel *old, struct ast_channel *new) struct ast_group_info *gi = NULL; AST_RWLIST_WRLOCK(&groups); - AST_RWLIST_TRAVERSE(&groups, gi, list) { - if (gi->chan == old) + AST_RWLIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) { + if (gi->chan == old) { gi->chan = new; + } else if (gi->chan == new) { + AST_RWLIST_REMOVE_CURRENT(list); + ast_free(gi); + } } + AST_RWLIST_TRAVERSE_SAFE_END AST_RWLIST_UNLOCK(&groups); return 0; |