From 769df9b5ac5a979ce5eb7789e3789ea60dc797ee Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 23 Jan 2015 17:47:41 +0100 Subject: [PATCH 1/3] Fixed unsupported variant type: 1024 (QJSValue) Added proper casting from QMetaType::User (1024) with userType 1034 (i.e., QJSValue) to QVariant so it can be handled properly by the packDataValue method. --- cpp/capi.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpp/capi.cpp b/cpp/capi.cpp index da705af4..55ac5857 100644 --- a/cpp/capi.cpp +++ b/cpp/capi.cpp @@ -743,6 +743,14 @@ void packDataValue(QVariant_ *var, DataValue *value) *(DataValue**)(value->data) = dvlist; } break; + case QMetaType::User: + { + if (qvar->userType() == 1034) { + auto var = qvar->value().toVariant(); + packDataValue(&var, value); + } + } + break; default: if (qvar->type() == (int)QMetaType::QObjectStar || qvar->canConvert()) { QObject *qobject = qvar->value(); From 807b51d4104231784fa5e336ccd26d61759a3cb2 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 27 Jan 2015 18:33:40 +0100 Subject: [PATCH 2/3] Changed to non-hardcoded type for QJSValue --- cpp/capi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/capi.cpp b/cpp/capi.cpp index 55ac5857..c2255aaa 100644 --- a/cpp/capi.cpp +++ b/cpp/capi.cpp @@ -745,7 +745,8 @@ void packDataValue(QVariant_ *var, DataValue *value) break; case QMetaType::User: { - if (qvar->userType() == 1034) { + static const int qjstype = QVariant::fromValue(QJSValue()).userType(); + if (qvar->userType() == qjstype) { auto var = qvar->value().toVariant(); packDataValue(&var, value); } From c288002b52e905973b131089a8a7c761d4a2c36a Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 5 Feb 2015 08:36:08 -0800 Subject: [PATCH 3/3] Fixed an issue with strlen checking null ptr Program called "Moom" (http://manytricks.com/moom/) which uses OS X's accesibility API could cause a crash with calling the log handler with a null file in context. --- cpp/capi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/capi.cpp b/cpp/capi.cpp index c2255aaa..024e5ec9 100644 --- a/cpp/capi.cpp +++ b/cpp/capi.cpp @@ -855,6 +855,8 @@ QQmlListProperty_ *newListProperty(GoAddr *addr, intptr_t reflectIndex, intptr_t void internalLogHandler(QtMsgType severity, const QMessageLogContext &context, const QString &text) { + if (context.file == NULL) return; + QByteArray textba = text.toUtf8(); LogMessage message = {severity, textba.constData(), textba.size(), context.file, (int)strlen(context.file), context.line}; hookLogHandler(&message);