From: Mark Michelson Date: Fri, 16 Nov 2012 05:00:42 +0000 (+0000) Subject: Test that shutdown callback is called when expected. X-Git-Tag: 13.0.0-beta1~2194^2~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec68a156191e9d8d6c752b9232b46a29f90a5cbb;p=thirdparty%2Fasterisk.git Test that shutdown callback is called when expected. git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376383 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/taskprocessor.c b/main/taskprocessor.c index 49e951f3fd..78118edb5d 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -565,6 +565,7 @@ struct ast_taskprocessor *ast_taskprocessor_create_with_listener(const char *nam void *ast_taskprocessor_unreference(struct ast_taskprocessor *tps) { struct ast_taskprocessor_listener *listener; + if (!tps) { return NULL; } diff --git a/tests/test_taskprocessor.c b/tests/test_taskprocessor.c index 424449dd9b..2ad172f418 100644 --- a/tests/test_taskprocessor.c +++ b/tests/test_taskprocessor.c @@ -239,8 +239,16 @@ AST_TEST_DEFINE(taskprocessor_listener) goto test_exit; } + tps = ast_taskprocessor_unreference(tps); + + if (!pvt->shutdown) { + res = AST_TEST_FAIL; + goto test_exit; + } + test_exit: ao2_ref(listener, -1); + /* This is safe even if tps is NULL */ ast_taskprocessor_unreference(tps); return res; }