Merged revisions 377743 via svnmerge from

file:///srv/subversion/repos/asterisk/trunk

................
  r377743 | rmudgett | 2012-12-10 20:13:37 -0600 (Mon, 10 Dec 2012) | 25 lines
  
  Cleanup indications on exit.
  
  * Made ast_unregister_indication_country() unlink the found tone zone
  before selecting a new default_tone_zone to make it impossible to select
  the tone zone being unregistered again.
  
  * Ringcadence is no longer parsed twice in store_config_tone_zone().
  
  * Cleanup CLI commands and destroy default_tone_zone on exit.
  
  (issue ASTERISK-20649)
  Reported by: Corey Farrell
  Patches:
        indications-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell
        Modified
  ........
  
  Merged revisions 377740 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 377741 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........
  
  Merged revisions 377742 from http://svn.asterisk.org/svn/asterisk/branches/11
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Automerge script 2012-12-11 02:19:39 +00:00
parent 56a9f5b6cb
commit 4abf332cf0
1 changed files with 10 additions and 5 deletions

View File

@ -560,11 +560,13 @@ static int ast_unregister_indication_country(const char *country)
ast_copy_string(zone_arg.country, country, sizeof(zone_arg.country));
if (!(tz = ao2_find(ast_tone_zones, &zone_arg, OBJ_POINTER))) {
ao2_lock(ast_tone_zones);
tz = ao2_find(ast_tone_zones, &zone_arg, OBJ_POINTER | OBJ_UNLINK);
if (!tz) {
ao2_unlock(ast_tone_zones);
return -1;
}
ao2_lock(ast_tone_zones);
if (default_tone_zone == tz) {
ast_tone_zone_unref(default_tone_zone);
/* Get a new default, punt to the first one we find */
@ -572,8 +574,6 @@ static int ast_unregister_indication_country(const char *country)
}
ao2_unlock(ast_tone_zones);
ao2_unlink(ast_tone_zones, tz);
tz = ast_tone_zone_unref(tz);
return 0;
@ -939,7 +939,6 @@ static void store_config_tone_zone(struct ast_tone_zone *zone, const char *var,
CV_STR("description", zone->description);
CV_F("ringcadence", store_tone_zone_ring_cadence(zone, value));
CV_F("ringcadance", store_tone_zone_ring_cadence(zone, value));
ast_register_indication(zone, var, value);
@ -1153,6 +1152,11 @@ int ast_tone_zone_data_add_structure(struct ast_data *tree, struct ast_tone_zone
/*! \internal \brief Clean up resources on Asterisk shutdown */
static void indications_shutdown(void)
{
ast_cli_unregister_multiple(cli_indications, ARRAY_LEN(cli_indications));
if (default_tone_zone) {
ast_tone_zone_unref(default_tone_zone);
default_tone_zone = NULL;
}
if (ast_tone_zones) {
ao2_ref(ast_tone_zones, -1);
ast_tone_zones = NULL;
@ -1168,6 +1172,7 @@ int ast_indications_init(void)
}
if (load_indications(0)) {
indications_shutdown();
return -1;
}