summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-29 15:22:52 (GMT)
committerTobias Markmann <tm@ayena.de>2016-09-29 15:22:52 (GMT)
commit9abfaaa771f91010dbe01a1b9b5b9e2801956718 (patch)
tree618a5f66ea97d3d8552f72aad6a8e1313c56ec6e /SwifTools/Idle
parent2bf44a1d641c3bc35546cb49d3766f2962f9a984 (diff)
downloadswift-9abfaaa771f91010dbe01a1b9b5b9e2801956718.zip
swift-9abfaaa771f91010dbe01a1b9b5b9e2801956718.tar.bz2
Fix uninitialised class members
Initialised previously uninitialised class members. Changed some raw pointers to std::unique_ptr for clearer and automatically initialised code. Test-Information: Builds on macOS 10.12 and unit tests pass in ASAN-enabled build. Change-Id: I7900fe6131119c228ca92c79c0ee8125137f2e48
Diffstat (limited to 'SwifTools/Idle')
-rw-r--r--SwifTools/Idle/UnitTest/ActualIdleDetectorTest.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/SwifTools/Idle/UnitTest/ActualIdleDetectorTest.cpp b/SwifTools/Idle/UnitTest/ActualIdleDetectorTest.cpp
index fa9b184..ecd72b1 100644
--- a/SwifTools/Idle/UnitTest/ActualIdleDetectorTest.cpp
+++ b/SwifTools/Idle/UnitTest/ActualIdleDetectorTest.cpp
@@ -30,16 +30,11 @@ class ActualIdleDetectorTest : public CppUnit::TestFixture {
public:
void setUp() {
- querier = new MockIdleQuerier();
- timerFactory = new MockTimerFactory();
+ querier = std::unique_ptr<MockIdleQuerier>(new MockIdleQuerier());
+ timerFactory = std::unique_ptr<MockTimerFactory>(new MockTimerFactory());
idleEvents.clear();
}
- void tearDown() {
- delete timerFactory;
- delete querier;
- }
-
void testDestructor() {
ActualIdleDetector* testling = createDetector();
testling->setIdleTimeSeconds(15);
@@ -101,7 +96,7 @@ class ActualIdleDetectorTest : public CppUnit::TestFixture {
private:
ActualIdleDetector* createDetector() {
- ActualIdleDetector* detector = new ActualIdleDetector(querier, timerFactory, 10);
+ ActualIdleDetector* detector = new ActualIdleDetector(querier.get(), timerFactory.get(), 10);
detector->onIdleChanged.connect(boost::bind(&ActualIdleDetectorTest::handleIdle, this, _1));
return detector;
}
@@ -165,8 +160,8 @@ class ActualIdleDetectorTest : public CppUnit::TestFixture {
std::vector<std::shared_ptr<MockTimer> > timers;
};
- MockIdleQuerier* querier;
- MockTimerFactory* timerFactory;
+ std::unique_ptr<MockIdleQuerier> querier;
+ std::unique_ptr<MockTimerFactory> timerFactory;
std::vector<bool> idleEvents;
};