[asterisk-commits] qwell: branch 10-digiumphones r378660 - in /branches/10-digiumphones: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 8 13:12:02 CST 2013


Author: qwell
Date: Tue Jan  8 13:11:56 2013
New Revision: 378660

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378660
Log:
Cleanup pbx on exit.

* Cleanup CLI commands on exit.

* Unreference hints and statecbs containers on exit.

(issue ASTERISK-20649)
Reported by: Corey Farrell
Patches:
      pbx-cleanup-1_8.patch (license #5909) patch uploaded by Corey Farrell
      pbx-cleanup-10.patch (license #5909) patch uploaded by Corey Farrell
      pbx-cleanup-11-trunk.patch (license #5909) patch uploaded by Corey Farrell
      Modified
........

Merged revisions 377806 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 377807 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/10-digiumphones/   (props changed)
    branches/10-digiumphones/main/pbx.c

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
--- branch-10-merged (original)
+++ branch-10-merged Tue Jan  8 13:11:56 2013
@@ -1,1 +1,1 @@
-/branches/10:1-377806
+/branches/10:1-377807

Modified: branches/10-digiumphones/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/main/pbx.c?view=diff&rev=378660&r1=378659&r2=378660
==============================================================================
--- branches/10-digiumphones/main/pbx.c (original)
+++ branches/10-digiumphones/main/pbx.c Tue Jan  8 13:11:56 2013
@@ -11069,12 +11069,17 @@
 	if (device_state_sub) {
 		device_state_sub = ast_event_unsubscribe(device_state_sub);
 	}
+	if (device_state_tps) {
+		ast_taskprocessor_unreference(device_state_tps);
+		device_state_tps = NULL;
+	}
 
 	/* Unregister builtin applications */
 	for (x = 0; x < ARRAY_LEN(builtins); x++) {
 		ast_unregister_application(builtins[x].name);
 	}
 	ast_manager_unregister("ShowDialPlan");
+	ast_cli_unregister_multiple(pbx_cli, ARRAY_LEN(pbx_cli));
 	ast_custom_function_unregister(&exception_function);
 	ast_custom_function_unregister(&testtime_function);
 	ast_data_unregister(NULL);
@@ -11083,6 +11088,8 @@
 int load_pbx(void)
 {
 	int x;
+
+	ast_register_atexit(unload_pbx);
 
 	/* Initialize the PBX */
 	ast_verb(1, "Asterisk PBX Core Initializing\n");
@@ -11118,7 +11125,6 @@
 		return -1;
 	}
 
-	ast_register_atexit(unload_pbx);
 	return 0;
 }
 
@@ -11479,17 +11485,23 @@
 	return (state_cb->change_cb == change_cb) ? CMP_MATCH | CMP_STOP : 0;
 }
 
-/*! \internal \brief Clean up resources on Asterisk shutdown */
+/*!
+ * \internal
+ * \brief Clean up resources on Asterisk shutdown
+ */
 static void pbx_shutdown(void)
 {
 	if (hints) {
 		ao2_ref(hints, -1);
+		hints = NULL;
 	}
 	if (hintdevices) {
 		ao2_ref(hintdevices, -1);
+		hintdevices = NULL;
 	}
 	if (statecbs) {
 		ao2_ref(statecbs, -1);
+		statecbs = NULL;
 	}
 }
 
@@ -11500,5 +11512,6 @@
 	statecbs = ao2_container_alloc(1, NULL, statecbs_cmp);
 
 	ast_register_atexit(pbx_shutdown);
+
 	return (hints && hintdevices && statecbs) ? 0 : -1;
 }




More information about the asterisk-commits mailing list