From 2991993f6b7399c88ccb048333d79ab30851f910 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 8 Nov 2018 15:03:41 +0100 Subject: [PATCH] Apply workaround for timer tests with std::bind callbacks --- test/base-timer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/base-timer.cpp b/test/base-timer.cpp index 48d20e381..a9500a203 100644 --- a/test/base-timer.cpp +++ b/test/base-timer.cpp @@ -39,16 +39,17 @@ BOOST_AUTO_TEST_CASE(interval) BOOST_CHECK(timer->GetInterval() == 1.5); } -static void Callback(int *counter) +int counter = 0; + +static void Callback(const Timer::Ptr&) { - (*counter)++; + counter++; } BOOST_AUTO_TEST_CASE(invoke) { - int counter; Timer::Ptr timer = new Timer(); - timer->OnTimerExpired.connect(std::bind(&Callback, &counter)); + timer->OnTimerExpired.connect(&Callback); timer->SetInterval(1); counter = 0; @@ -61,9 +62,8 @@ BOOST_AUTO_TEST_CASE(invoke) BOOST_AUTO_TEST_CASE(scope) { - int counter; Timer::Ptr timer = new Timer(); - timer->OnTimerExpired.connect(std::bind(&Callback, &counter)); + timer->OnTimerExpired.connect(&Callback); timer->SetInterval(1); counter = 0;