From: "Lubomir I. Ivanov" <[email protected]> For some reason on Windows 10 the NullDevice class approach causes an infinite loop because QtCore cannot obtain a mutex lock (ntdll.dll!_NtWaitForSingleObject) for the text stream.
Using this method of passing the location of the system null device to QFile, "should" work better. Reported-by: Stefan Fuchs <[email protected]> Signed-off-by: Lubomir I. Ivanov <[email protected]> --- untested in marble for the reported use case! i've tested it in a standalone "hello-world" type of project. this is a patch for the MarbleDebug.cpp file in the Subsurface branch: against 4325da9 [ssrf/Subsurface-branch] --- src/lib/marble/MarbleDebug.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/lib/marble/MarbleDebug.cpp b/src/lib/marble/MarbleDebug.cpp index 8e237d9..615bfe1 100644 --- a/src/lib/marble/MarbleDebug.cpp +++ b/src/lib/marble/MarbleDebug.cpp @@ -10,37 +10,23 @@ #include "MarbleDebug.h" +#include <QFile> +#include <QProcess> + namespace Marble { bool MarbleDebug::m_enabled = false; -class NullDevice : public QIODevice -{ -public: - NullDevice() - { - open( QIODevice::WriteOnly ); - } - - qint64 readData( char * /*data*/, qint64 /*maxSize*/ ) - { - return -1; - } - - qint64 writeData( const char * /*data*/, qint64 maxSize ) - { - return maxSize; - } -}; - QDebug mDebug() { if ( MarbleDebug::isEnabled() ) { return QDebug( QtDebugMsg ); } else { - static QIODevice *device = new NullDevice; - return QDebug( device ); + static QFile *nullDevice = new QFile(QProcess::nullDevice()); + if ( !nullDevice->isOpen() ) + nullDevice->open(QIODevice::WriteOnly); + return QDebug( nullDevice ); } } -- 1.7.11.msysgit.0 _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
