summaryrefslogtreecommitdiff
path: root/ACE/tests/MT_Reactor_Timer_Test.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2014-09-16 18:11:56 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2014-09-16 18:11:56 +0000
commit37b61d612f24c4015252996a58d040eb7843dd76 (patch)
tree8dc2eee3b6416764385bda5a4aa5c59ca0ddcb41 /ACE/tests/MT_Reactor_Timer_Test.cpp
parentbc97d492399217f00fbd94ad76f1f6d81433186b (diff)
downloadATCD-37b61d612f24c4015252996a58d040eb7843dd76.tar.gz
Tue Sep 16 18:11:58 UTC 2014 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/Dev_Poll_Reactor.cpp: * ace/Reactor.h: * ace/Select_Reactor_T.cpp: * ace/WFMO_Reactor.inl: When using ACE_Event_Handler_var together with reference counting it is easy to pass the var.handler() to the cancel_timer() operation of the reactor to just cancel all timers at shutdown. But, when the application specific initialization fails which leads to the fact that the var contains a nullptr, this leads to a crash. Updated all cancel_timer operations to also check if a valid event handler pointer has been passed. If not, we just return 0 * tests/MT_Reactor_Timer_Test.cpp: Added test for use case mentioned above
Diffstat (limited to 'ACE/tests/MT_Reactor_Timer_Test.cpp')
-rw-r--r--ACE/tests/MT_Reactor_Timer_Test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/ACE/tests/MT_Reactor_Timer_Test.cpp b/ACE/tests/MT_Reactor_Timer_Test.cpp
index 01fc16210c4..fb845f3b2e5 100644
--- a/ACE/tests/MT_Reactor_Timer_Test.cpp
+++ b/ACE/tests/MT_Reactor_Timer_Test.cpp
@@ -114,6 +114,11 @@ Time_Handler::svc (void)
ACE_TEST_ASSERT (r->cancel_timer (this->timer_id_[4]) == 1);
this->timer_id_[4] = Time_Handler::TIMER_CANCELLED;
+ // Test that cancelling a timers through a nill ACE_Event_Handler
+ // pointer just does nothing instead of crash
+ ACE_Event_Handler_var timer_var;
+ ACE_TEST_ASSERT (r->cancel_timer (timer_var.handler()) == 0);
+
return 0;
}