Browse Source

[2916] reset global IOService to NULL at end of test for safer operation

JINMEI Tatuya 12 years ago
parent
commit
da5d0b9b61
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/lib/asiolink/tests/local_socket_unittest.cc

+ 4 - 0
src/lib/asiolink/tests/local_socket_unittest.cc

@@ -76,6 +76,10 @@ protected:
 
     ~LocalSocketTest() {
         alarm(0);
+        // reset the global to NULL to detect any invalid access to freed
+        // io_service (this shouldn't happen, so we don't change stopIOService
+        // itself)
+        g_io_service_ = NULL;
         std::signal(SIGALRM, prev_handler_);
     }