Browse Source

[3407] valgrind complained on a unit test

scheduled write timer was not getting cancelled
before IOService is destroyed.
Thomas Markwalder 11 years ago
parent
commit
7abc8bffa2
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/bin/d2/tests/d_test_stubs.h

+ 4 - 0
src/bin/d2/tests/d_test_stubs.h

@@ -329,6 +329,10 @@ public:
     /// Note the controller singleton is destroyed. This is essential to ensure
     /// Note the controller singleton is destroyed. This is essential to ensure
     /// a clean start between tests.
     /// a clean start between tests.
     virtual ~DControllerTest() {
     virtual ~DControllerTest() {
+        if (write_timer_) {
+            write_timer_->cancel();
+        }
+
         getController().reset();
         getController().reset();
         static_cast<void>(unlink(CFG_TEST_FILE));
         static_cast<void>(unlink(CFG_TEST_FILE));
     }
     }