From c43dd3a4db1730454c43ef6a074ca3de03f309d3 Mon Sep 17 00:00:00 2001 From: blankie Date: Tue, 7 Feb 2023 13:36:51 +0700 Subject: [PATCH] Clear logcat entries when (re)starting logcat --- logcat_thread.cpp | 1 + windows/main.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/logcat_thread.cpp b/logcat_thread.cpp index 2fe2666..19d5a50 100644 --- a/logcat_thread.cpp +++ b/logcat_thread.cpp @@ -302,6 +302,7 @@ bool LogcatThread::_handle_start_request() { } }; + // TODO what if *this->_logcat_command was mutated during copying? std::string logcat_command = *this->_logcat_command; if (logcat_command.empty()) { logcat_command = default_logcat_command; diff --git a/windows/main.cpp b/windows/main.cpp index 97da8e4..d7518cb 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -100,6 +100,8 @@ void main_window(bool latest_log_entries_read, ImFont* monospace_font, LogcatThr } if (ImGui::Button("Start", !logcat_running)) { + logcat_entries.clear(); + filtered_logcat_entry_offsets.clear(); logcat_thread.logcat_process_request.store(LogcatProcessRequest::Start); } ImGui::SameLine(); @@ -108,6 +110,8 @@ void main_window(bool latest_log_entries_read, ImFont* monospace_font, LogcatThr } ImGui::SameLine(); if (ImGui::Button("Restart", logcat_running)) { + logcat_entries.clear(); + filtered_logcat_entry_offsets.clear(); logcat_thread.logcat_process_request.store(LogcatProcessRequest::Start); }