]> sigrok.org Git - pulseview.git/blobdiff - pv/logging.cpp
Fix regression introduced by 2980ff2da269c9ed
[pulseview.git] / pv / logging.cpp
index 9740690e7f33e87364a4a915c22499127b3f0cc2..dea333e534489b78bae632da28ccad90c56e35bd 100644 (file)
 
 #include <QApplication>
 
+using std::lock_guard;
+
 namespace pv {
 
 Logging logging;
 
+const int Logging::MIN_BUFFER_SIZE = 10;
 const int Logging::MAX_BUFFER_SIZE = 50000;
 
 Logging::~Logging()
@@ -72,7 +75,9 @@ int Logging::get_log_level() const
 void Logging::set_log_level(int level)
 {
        sr_log_loglevel_set(level);
+#ifdef ENABLE_DECODE
        srd_log_loglevel_set(level);
+#endif
 }
 
 QString Logging::get_log() const
@@ -82,6 +87,8 @@ QString Logging::get_log() const
 
 void Logging::log(const QString &text, int source)
 {
+       lock_guard<mutex> log_lock(log_mutex_);
+
        if (buffer_.size() >= buffer_size_)
                buffer_.removeFirst();