aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8qobjectwrapper.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2011-12-29 10:32:52 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-29 05:52:22 +0100
commit8eec0518d628b59d4e6bfe3ee68ddabb1f83df08 (patch)
tree8ce268e05c6fe00ee199737b2a45561c37d9b6eb /src/declarative/qml/v8/qv8qobjectwrapper.cpp
parent78100927823edf9001d31c33162c634b5e4cf9d4 (diff)
Handle exceptions inside QV8QObjectConnectionList::qt_metacall
Previously, exceptions were not handled in the connectionlist. This could cause v8 to assert under certain circumstances. Task-number: QTBUG-23375 Change-Id: Ie5f043b50bb6b02a77be464ca18ea8e3bbb0f501 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8qobjectwrapper.cpp')
-rw-r--r--src/declarative/qml/v8/qv8qobjectwrapper.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
index 40ad93a544..098894aeb0 100644
--- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp
@@ -51,6 +51,7 @@
#include <private/qjsvalue_p.h>
#include <private/qscript_impl_p.h>
#include <private/qdeclarativeaccessors_p.h>
+#include <private/qdeclarativeexpression_p.h>
#include <QtDeclarative/qjsvalue.h>
#include <QtCore/qvarlengtharray.h>
@@ -1229,11 +1230,22 @@ int QV8QObjectConnectionList::qt_metacall(QMetaObject::Call method, int index, v
Connection &connection = connections[ii];
if (connection.needsDestroy)
continue;
+
+ v8::TryCatch try_catch;
if (connection.thisObject.IsEmpty()) {
connection.function->Call(engine->global(), argCount, args.data());
} else {
connection.function->Call(connection.thisObject, argCount, args.data());
}
+
+ if (try_catch.HasCaught()) {
+ QDeclarativeError error;
+ error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(engine->toString(connection.function->GetName())));
+ v8::Local<v8::Message> message = try_catch.Message();
+ if (!message.IsEmpty())
+ QDeclarativeExpressionPrivate::exceptionToError(message, error);
+ QDeclarativeEnginePrivate::get(engine->engine())->warning(error);
+ }
}
connectionList.connectionsInUse--;