[asterisk-commits] dlee: branch dlee/stasis-app r382540 - in /team/dlee/stasis-app: apps/ tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 6 14:47:00 CST 2013


Author: dlee
Date: Wed Mar  6 14:46:57 2013
New Revision: 382540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382540
Log:
Fixed test/app load ordering issue

Modified:
    team/dlee/stasis-app/apps/app_stasis.c
    team/dlee/stasis-app/tests/test_app_stasis.c

Modified: team/dlee/stasis-app/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/apps/app_stasis.c?view=diff&rev=382540&r1=382539&r2=382540
==============================================================================
--- team/dlee/stasis-app/apps/app_stasis.c (original)
+++ team/dlee/stasis-app/apps/app_stasis.c Wed Mar  6 14:46:57 2013
@@ -503,9 +503,12 @@
 
 void stasis_app_unregister(const char *app_name)
 {
-	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
-
-	ao2_cleanup(ao2_find(apps, app_name, OBJ_KEY | OBJ_UNLINK));
+	RAII_VAR(struct ao2_container *, apps, NULL, ao2_cleanup);
+
+	if (app_name) {
+		apps = apps_registry();
+		ao2_cleanup(ao2_find(apps, app_name, OBJ_KEY | OBJ_UNLINK));
+	}
 }
 
 static int load_module(void)

Modified: team/dlee/stasis-app/tests/test_app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/tests/test_app_stasis.c?view=diff&rev=382540&r1=382539&r2=382540
==============================================================================
--- team/dlee/stasis-app/tests/test_app_stasis.c (original)
+++ team/dlee/stasis-app/tests/test_app_stasis.c Wed Mar  6 14:46:57 2013
@@ -93,7 +93,7 @@
 AST_TEST_DEFINE(app_invoke_one)
 {
 	RAII_VAR(struct app_data *, app_data, NULL, app_data_dtor);
-	RAII_VAR(char *, app_name, "test-handler", stasis_app_unregister);
+	RAII_VAR(char *, app_name, NULL, stasis_app_unregister);
 	RAII_VAR(struct ast_json *, expected_message, NULL, ast_json_unref);
 	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
 	int res;
@@ -108,6 +108,8 @@
 	case TEST_EXECUTE:
 		break;
 	}
+
+	app_name = "test-handler";
 
 	app_data = app_data_create();
 
@@ -127,7 +129,7 @@
 {
 	RAII_VAR(struct app_data *, app_data1, NULL, app_data_dtor);
 	RAII_VAR(struct app_data *, app_data2, NULL, app_data_dtor);
-	RAII_VAR(char *, app_name, "test-handler", stasis_app_unregister);
+	RAII_VAR(char *, app_name, NULL, stasis_app_unregister);
 	RAII_VAR(struct ast_json *, expected_message1, NULL, ast_json_unref);
 	RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
 	RAII_VAR(struct ast_json *, expected_message2, NULL, ast_json_unref);
@@ -143,6 +145,8 @@
 	case TEST_EXECUTE:
 		break;
 	}
+
+	app_name = "test-handler";
 
 	app_data1 = app_data_create();
 	app_data2 = app_data_create();




More information about the asterisk-commits mailing list