From 4ef2bcc01a6c5b00c1cdeea6b95773fb78a13c4d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 27 Oct 2015 17:19:35 -0700 Subject: [PATCH] Don't create libuv objects on the stack --- test/storage/http_retry_network_status.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/storage/http_retry_network_status.cpp b/test/storage/http_retry_network_status.cpp index 238108153..14cdae02c 100644 --- a/test/storage/http_retry_network_status.cpp +++ b/test/storage/http_retry_network_status.cpp @@ -1,6 +1,6 @@ #include "storage.hpp" -#include +#include #include #include @@ -36,17 +36,15 @@ TEST_F(Storage, HTTPNetworkStatusChange) { }); // After 50 milliseconds, we're going to trigger a NetworkStatus change. - uv_timer_t reachableTimer; - uv_timer_init(uv_default_loop(), &reachableTimer); - uv_timer_start(&reachableTimer, [] (uv_timer_t*) { + uv::timer reachableTimer(uv_default_loop()); + reachableTimer.start(50, 0, [] () { mbgl::NetworkStatus::Reachable(); - }, 50, 0); + }); // This timer will keep the loop alive to make sure we would be getting a response in caes the // network status change triggered another change (which it shouldn't). - uv_timer_t delayTimer; - uv_timer_init(uv_default_loop(), &delayTimer); - uv_timer_start(&delayTimer, [] (uv_timer_t*) {}, 300, 0); + uv::timer delayTimer(uv_default_loop()); + delayTimer.start(300, 0, [] () {}); uv_run(uv_default_loop(), UV_RUN_DEFAULT); }