diff options
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r-- | tools/qml/main.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index a75023b..4b1162e 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -49,12 +49,15 @@ #include <QTranslator> #include <QDebug> #include <QMessageBox> +#include <QAtomicInt> #include "qdeclarativetester.h" QT_USE_NAMESPACE QtMsgHandler systemMsgOutput = 0; + + #if defined (Q_OS_SYMBIAN) #include <unistd.h> #include <sys/types.h> @@ -89,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); } } @@ -119,7 +128,7 @@ void usage() qWarning(" -fullscreen............................... run fullscreen"); qWarning(" -stayontop................................ keep viewer window on top"); qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content"); - qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view"); + qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view (default)"); qWarning(" -qmlbrowser .............................. use a QML-based file browser"); qWarning(" -warnings [show|hide]..................... show warnings in a separate log window"); qWarning(" -recordfile <output> ..................... set video recording file"); @@ -200,6 +209,8 @@ int main(int argc, char ** argv) app.setOrganizationName("Nokia"); app.setOrganizationDomain("nokia.com"); + + QDeclarativeViewer::registerTypes(); QDeclarativeTester::registerTypes(); |