Parcourir la source

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

JINMEI Tatuya il y a 12 ans
Parent
commit
da5d0b9b61
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  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_);
     }