From a1ef65b71cb2cb89b50e39e137a1a3d2f762347e Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 28 May 2018 15:46:38 +0200 Subject: [PATCH] set _ptr to nullptr after reset() --- CMakeLists.txt | 2 +- src/masto.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5009d03..3cc041c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.8.1 + VERSION 0.8.2 LANGUAGES CXX ) diff --git a/src/masto.cpp b/src/masto.cpp index ccf1600..557cc36 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -85,9 +85,10 @@ const void Listener::read_config() const void Listener::start() { - static std::uint_fast16_t ret = 0; + static std::uint_fast16_t ret; _thread = std::thread([=] { + ret = 0; _running = true; Easy masto(_instance, _access_token); masto.set_useragent(static_cast("expandurl-mastodon/") + @@ -103,7 +104,7 @@ const void Listener::start() } _running = false; }); - while (_ptr == nullptr) + while (!_ptr) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } @@ -125,6 +126,7 @@ const void Listener::stop() _ptr->cancel_stream(); _thread.join(); _ptr.reset(); + _ptr = nullptr; _stream = ""; } else