Vincent van Ravesteijn wrote:
> One hypothesis might be that we're doing not so thread-safe things. You 
> emit a qt-signal to flush the stream, but at the time that we are flushing 
> it, we might already be writing stuff to it.

does such kind of patch help? probably combined with patch above.
maybe even to put it on the begining/end of the whole function.
pavel
diff --git a/src/support/debug.cpp b/src/support/debug.cpp
index e0f7b11..dfc14c8 100644
--- a/src/support/debug.cpp
+++ b/src/support/debug.cpp
@@ -21,6 +21,7 @@
 
 #include <iostream>
 #include <iomanip>
+#include <QMutex>
 
 using namespace std;
 using namespace lyx::support;
@@ -195,6 +196,7 @@ void LyXErr::endl()
        }
 }
 
+QMutex qm;
 
 // It seems not possible to instantiate operator template out of class body
 template<class T>
@@ -203,8 +205,10 @@ LyXErr & toStream(LyXErr & l, T t)
        if (l.enabled()){
                l.stream() << t;
                if (l.second_used()){
+                       qm.lock();
                        l.second() << t;
                        ProgressInterface::instance()->lyxerrFlush();
+                       qm.unlock();
                }
        }
        return l;

Reply via email to