From 7cc9a092b189dca97867345c9a5b703f4fada938 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Oct 2016 07:01:35 -0400 Subject: Fix flushing many message window lines at once --- src/gui/MessagesWindow.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/gui/MessagesWindow.cpp b/src/gui/MessagesWindow.cpp index fb29716c..a646f2de 100644 --- a/src/gui/MessagesWindow.cpp +++ b/src/gui/MessagesWindow.cpp @@ -102,24 +102,26 @@ MessagesWindow::log(LV2_URID type, const char* fmt, va_list args) void MessagesWindow::flush() { - LV2_URID type; - std::string line; - { - std::lock_guard lock(_mutex); - if (!_stream.rdbuf()->in_avail()) { - return; + while (true) { + LV2_URID type; + std::string line; + { + std::lock_guard lock(_mutex); + if (!_stream.rdbuf()->in_avail()) { + return; + } + _stream >> type; + std::getline(_stream, line, '\0'); } - _stream >> type; - std::getline(_stream, line, '\0'); - } - Glib::RefPtr text_buf = _textview->get_buffer(); + Glib::RefPtr text_buf = _textview->get_buffer(); - auto t = _tags.find(type); - if (t != _tags.end()) { - text_buf->insert_with_tag(text_buf->end(), line, t->second); - } else { - text_buf->insert(text_buf->end(), line); + auto t = _tags.find(type); + if (t != _tags.end()) { + text_buf->insert_with_tag(text_buf->end(), line, t->second); + } else { + text_buf->insert(text_buf->end(), line); + } } if (!_clear_button->is_sensitive()) { -- cgit v1.2.1