summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-01 07:01:35 -0400
committerDavid Robillard <d@drobilla.net>2016-10-01 07:03:02 -0400
commit7cc9a092b189dca97867345c9a5b703f4fada938 (patch)
tree3bad1676dc09791f665c21a014708b0dcd3aa228 /src/gui
parent8df90e13115348807fcea0c1d81bca1b2ec053a0 (diff)
downloadingen-7cc9a092b189dca97867345c9a5b703f4fada938.tar.gz
ingen-7cc9a092b189dca97867345c9a5b703f4fada938.tar.bz2
ingen-7cc9a092b189dca97867345c9a5b703f4fada938.zip
Fix flushing many message window lines at once
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/MessagesWindow.cpp32
1 files 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<std::mutex> lock(_mutex);
- if (!_stream.rdbuf()->in_avail()) {
- return;
+ while (true) {
+ LV2_URID type;
+ std::string line;
+ {
+ std::lock_guard<std::mutex> lock(_mutex);
+ if (!_stream.rdbuf()->in_avail()) {
+ return;
+ }
+ _stream >> type;
+ std::getline(_stream, line, '\0');
}
- _stream >> type;
- std::getline(_stream, line, '\0');
- }
- Glib::RefPtr<Gtk::TextBuffer> text_buf = _textview->get_buffer();
+ Glib::RefPtr<Gtk::TextBuffer> 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()) {