You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/03/16 01:21:16 UTC

svn commit: r1457175 - /incubator/mesos/trunk/src/tests/filter.hpp

Author: benh
Date: Sat Mar 16 00:21:16 2013
New Revision: 1457175

URL: http://svn.apache.org/r1457175
Log:
Removed filter in test event listener instead of in destructor.

Review: https://reviews.apache.org/r/9967

Modified:
    incubator/mesos/trunk/src/tests/filter.hpp

Modified: incubator/mesos/trunk/src/tests/filter.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/tests/filter.hpp?rev=1457175&r1=1457174&r2=1457175&view=diff
==============================================================================
--- incubator/mesos/trunk/src/tests/filter.hpp (original)
+++ incubator/mesos/trunk/src/tests/filter.hpp Sat Mar 16 00:21:16 2013
@@ -72,13 +72,6 @@ public:
       .WillRepeatedly(testing::Return(false));
     EXPECT_CALL(*this, filter(testing::A<const process::ExitedEvent&>()))
       .WillRepeatedly(testing::Return(false));
-
-    process::filter(this);
-  }
-
-  virtual ~TestsFilter()
-  {
-    process::filter(NULL);
   }
 
   MOCK_METHOD1(filter, bool(const process::MessageEvent&));
@@ -94,7 +87,12 @@ inline TestsFilter* filter()
     return TestsFilter::instance;
   }
 
-  return TestsFilter::instance = new TestsFilter();
+  TestsFilter::instance = new TestsFilter();
+
+  // Set the filter in libprocess.
+  process::filter(TestsFilter::instance);
+
+  return TestsFilter::instance;
 }
 
 
@@ -104,6 +102,8 @@ public:
   virtual void OnTestEnd(const ::testing::TestInfo&)
   {
     if (TestsFilter::instance != NULL) {
+      // Remove the filter in libprocess _before_ deleting.
+      process::filter(NULL);
       delete TestsFilter::instance;
       TestsFilter::instance = NULL;
     }