summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorToby Tomkins <toby.tomkins@nokia.com>2010-07-27 05:37:43 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-07-27 05:47:52 (GMT)
commit0f989739f4b0ab72c3fa0a25e91edf7641b91fdb (patch)
treeb84ed690f4550c670da703172d56f1b53545b973 /tools/qml
parent14bbc9fc1482f2f60d6acb5cd35cfe121e9d5b8e (diff)
downloadQt-0f989739f4b0ab72c3fa0a25e91edf7641b91fdb.zip
Qt-0f989739f4b0ab72c3fa0a25e91edf7641b91fdb.tar.gz
Qt-0f989739f4b0ab72c3fa0a25e91edf7641b91fdb.tar.bz2
Copied Qt QML 4.7 branch to release.
Reviewed-by: MArtin Jones
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/main.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 6461b67..4b1162e 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -49,6 +49,7 @@
#include <QTranslator>
#include <QDebug>
#include <QMessageBox>
+#include <QAtomicInt>
#include "qdeclarativetester.h"
QT_USE_NAMESPACE
@@ -91,19 +92,25 @@ void showWarnings()
}
}
+static QAtomicInt recursiveLock(0);
+
void myMessageOutput(QtMsgType type, const char *msg)
{
- if (!logger.isNull()) {
- QString strMsg = QString::fromAscii(msg);
- QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ QString strMsg = QString::fromLatin1(msg);
+
+ if (!logger.isNull() && !QCoreApplication::closingDown()) {
+ if (recursiveLock.testAndSetOrdered(0, 1)) {
+ QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ recursiveLock = 0;
+ }
} else {
- warnings += msg;
+ warnings += strMsg;
warnings += QLatin1Char('\n');
}
if (systemMsgOutput) { // Windows
systemMsgOutput(type, msg);
} else { // Unix
- fprintf(stderr, "%s\n",msg);
+ fprintf(stderr, "%s\n", msg);
fflush(stderr);
}
}