mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 05:37:34 +02:00
Fixed object deletion event, temporarily disabled watchdog log commands to make reading logs easier
This commit is contained in:
parent
0c9a403313
commit
30620d8899
6 changed files with 35 additions and 23 deletions
|
@ -448,38 +448,38 @@ public:
|
||||||
|
|
||||||
if (elapsedMovingAverage > _maxElapsedAverage * 1.1f) {
|
if (elapsedMovingAverage > _maxElapsedAverage * 1.1f) {
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
/* qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||||
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
||||||
<< "maxElapsed:" << _maxElapsed
|
<< "maxElapsed:" << _maxElapsed
|
||||||
<< "PREVIOUS maxElapsedAverage:" << _maxElapsedAverage
|
<< "PREVIOUS maxElapsedAverage:" << _maxElapsedAverage
|
||||||
<< "NEW maxElapsedAverage:" << elapsedMovingAverage << "** NEW MAX ELAPSED AVERAGE **"
|
<< "NEW maxElapsedAverage:" << elapsedMovingAverage << "** NEW MAX ELAPSED AVERAGE **"
|
||||||
<< "samples:" << _movingAverage.getSamples();
|
<< "samples:" << _movingAverage.getSamples();*/
|
||||||
#endif
|
#endif
|
||||||
_maxElapsedAverage = elapsedMovingAverage;
|
_maxElapsedAverage = elapsedMovingAverage;
|
||||||
}
|
}
|
||||||
if (lastHeartbeatAge > _maxElapsed) {
|
if (lastHeartbeatAge > _maxElapsed) {
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
/* qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||||
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
||||||
<< "PREVIOUS maxElapsed:" << _maxElapsed
|
<< "PREVIOUS maxElapsed:" << _maxElapsed
|
||||||
<< "NEW maxElapsed:" << lastHeartbeatAge << "** NEW MAX ELAPSED **"
|
<< "NEW maxElapsed:" << lastHeartbeatAge << "** NEW MAX ELAPSED **"
|
||||||
<< "maxElapsedAverage:" << _maxElapsedAverage
|
<< "maxElapsedAverage:" << _maxElapsedAverage
|
||||||
<< "samples:" << _movingAverage.getSamples();
|
<< "samples:" << _movingAverage.getSamples();*/
|
||||||
#endif
|
#endif
|
||||||
_maxElapsed = lastHeartbeatAge;
|
_maxElapsed = lastHeartbeatAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) {
|
/* if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) {
|
||||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||||
<< "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **"
|
<< "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **"
|
||||||
<< "maxElapsed:" << _maxElapsed
|
<< "maxElapsed:" << _maxElapsed
|
||||||
<< "maxElapsedAverage:" << _maxElapsedAverage
|
<< "maxElapsedAverage:" << _maxElapsedAverage
|
||||||
<< "samples:" << _movingAverage.getSamples();
|
<< "samples:" << _movingAverage.getSamples();
|
||||||
}
|
}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) {
|
if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) {
|
||||||
|
|
|
@ -187,7 +187,7 @@ void GraphicsEngine::render_performFrame() {
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(render, "/pluginBeginFrameRender");
|
PROFILE_RANGE(render, "/pluginBeginFrameRender");
|
||||||
// If a display plugin loses it's underlying support, it
|
// If a display plugin loses its underlying support, it
|
||||||
// needs to be able to signal us to not use it
|
// needs to be able to signal us to not use it
|
||||||
if (!displayPlugin->beginFrameRender(_renderFrameCount)) {
|
if (!displayPlugin->beginFrameRender(_renderFrameCount)) {
|
||||||
QMetaObject::invokeMethod(qApp, "updateDisplayMode");
|
QMetaObject::invokeMethod(qApp, "updateDisplayMode");
|
||||||
|
@ -267,7 +267,7 @@ void GraphicsEngine::render_performFrame() {
|
||||||
PROFILE_RANGE(render, "/renderOverlay");
|
PROFILE_RANGE(render, "/renderOverlay");
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
// NOTE: There is no batch associated with this renderArgs
|
// NOTE: There is no batch associated with this renderArgs
|
||||||
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
// the ApplicationOverlay class assumes it's viewport is set up to be the device size
|
||||||
renderArgs._viewport = glm::ivec4(0, 0, qApp->getDeviceSize());
|
renderArgs._viewport = glm::ivec4(0, 0, qApp->getDeviceSize());
|
||||||
qApp->getApplicationOverlay().renderOverlay(&renderArgs);
|
qApp->getApplicationOverlay().renderOverlay(&renderArgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ public: // not for public use, but I don't like how Qt strings this along with p
|
||||||
int computeCastPenalty(const V8ScriptValue& val, int destTypeId);
|
int computeCastPenalty(const V8ScriptValue& val, int destTypeId);
|
||||||
bool castValueToVariant(const V8ScriptValue& val, QVariant& dest, int destTypeId);
|
bool castValueToVariant(const V8ScriptValue& val, QVariant& dest, int destTypeId);
|
||||||
V8ScriptValue castVariantToValue(const QVariant& val);
|
V8ScriptValue castVariantToValue(const QVariant& val);
|
||||||
static QString valueType(const V8ScriptValue& val);
|
QString valueType(const V8ScriptValue& val);
|
||||||
v8::Isolate* getIsolate() {return _v8Isolate;}
|
v8::Isolate* getIsolate() {return _v8Isolate;}
|
||||||
v8::Local<v8::Context> getContext() {
|
v8::Local<v8::Context> getContext() {
|
||||||
v8::EscapableHandleScope handleScope(_v8Isolate);
|
v8::EscapableHandleScope handleScope(_v8Isolate);
|
||||||
|
|
|
@ -315,6 +315,7 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString errorMessage("");
|
||||||
// do we have a registered handler for this type?
|
// do we have a registered handler for this type?
|
||||||
ScriptEngine::DemarshalFunction demarshalFunc = nullptr;
|
ScriptEngine::DemarshalFunction demarshalFunc = nullptr;
|
||||||
{
|
{
|
||||||
|
@ -473,8 +474,10 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// V8TODO maybe export as JSON and then convert from JSON to QVariant?
|
errorMessage = QString() + "Conversion to variant failed: " + QString(*v8::String::Utf8Value(_v8Isolate, val->ToDetailString(getConstContext()).ToLocalChecked()))
|
||||||
Q_ASSERT(false);
|
+ " Destination type: " + QMetaType::typeName(destTypeId);
|
||||||
|
qDebug() << errorMessage;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// check to see if this is a pointer to a QObject-derived object
|
// check to see if this is a pointer to a QObject-derived object
|
||||||
if (QMetaType::typeFlags(destTypeId) & (QMetaType::PointerToQObject | QMetaType::TrackingPointerToQObject)) {
|
if (QMetaType::typeFlags(destTypeId) & (QMetaType::PointerToQObject | QMetaType::TrackingPointerToQObject)) {
|
||||||
|
@ -502,7 +505,7 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
||||||
}
|
}
|
||||||
// last chance, just convert it to a variant (impossible on V8)
|
// last chance, just convert it to a variant (impossible on V8)
|
||||||
// V8TODO
|
// V8TODO
|
||||||
QString errorMessage = QString() + "Converting: " + QString(*v8::String::Utf8Value(_v8Isolate, val->ToDetailString(getConstContext()).ToLocalChecked()))
|
errorMessage = QString() + "Conversion failure: " + QString(*v8::String::Utf8Value(_v8Isolate, val->ToDetailString(getConstContext()).ToLocalChecked()))
|
||||||
+ "to variant. Destination type: " + QMetaType::typeName(destTypeId);
|
+ "to variant. Destination type: " + QMetaType::typeName(destTypeId);
|
||||||
qDebug() << errorMessage;
|
qDebug() << errorMessage;
|
||||||
if(destTypeId == QMetaType::QVariant) {
|
if(destTypeId == QMetaType::QVariant) {
|
||||||
|
@ -550,9 +553,12 @@ QString ScriptEngineV8::valueType(const V8ScriptValue& v8Val) {
|
||||||
return var.typeName();
|
return var.typeName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//V8TODO
|
QVariant dest;
|
||||||
Q_ASSERT(false);
|
if (castValueToVariant(v8Val, dest, QMetaType::QVariant)) {
|
||||||
//return val->toVariant().typeName();
|
return dest.typeName();
|
||||||
|
}
|
||||||
|
qDebug() << "Cast to variant failed";
|
||||||
|
// V8TODO: what to return here?
|
||||||
return "undefined";
|
return "undefined";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o
|
||||||
return V8ScriptValue(engine->getIsolate(), proxy.get()->toV8Value());
|
return V8ScriptValue(engine->getIsolate(), proxy.get()->toV8Value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// V8TODO add a V8 callback that removes pointer from the map so that it gets deleted
|
// V8TODO add a V8 callback that removes pointer for the script engine owned ob from the map so that it gets deleted
|
||||||
// register the wrapper with the engine and make sure it cleans itself up
|
// register the wrapper with the engine and make sure it cleans itself up
|
||||||
engine->_qobjectWrapperMap.insert(object, proxy);
|
engine->_qobjectWrapperMap.insert(object, proxy);
|
||||||
engine->_qobjectWrapperMapV8.insert(object, proxy);
|
engine->_qobjectWrapperMapV8.insert(object, proxy);
|
||||||
|
@ -126,6 +126,10 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o
|
||||||
if (lookup != enginePtr->_qobjectWrapperMap.end()) {
|
if (lookup != enginePtr->_qobjectWrapperMap.end()) {
|
||||||
enginePtr->_qobjectWrapperMap.erase(lookup);
|
enginePtr->_qobjectWrapperMap.erase(lookup);
|
||||||
}
|
}
|
||||||
|
auto lookupV8 = enginePtr->_qobjectWrapperMapV8.find(object);
|
||||||
|
if (lookupV8 != enginePtr->_qobjectWrapperMapV8.end()) {
|
||||||
|
enginePtr->_qobjectWrapperMapV8.erase(lookupV8);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +142,7 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(const V8ScriptValue& val)
|
||||||
v8::HandleScope handleScope(const_cast<v8::Isolate*>(val.constGetIsolate()));
|
v8::HandleScope handleScope(const_cast<v8::Isolate*>(val.constGetIsolate()));
|
||||||
auto v8Value = val.constGet();
|
auto v8Value = val.constGet();
|
||||||
if (!v8Value->IsObject()) {
|
if (!v8Value->IsObject()) {
|
||||||
qDebug(scriptengine) << "Cannot unwrap proxy - value is not an object";
|
//qDebug(scriptengine) << "Cannot unwrap proxy - value is not an object";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value);
|
v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value);
|
||||||
|
@ -159,7 +163,7 @@ QObject* ScriptObjectV8Proxy::unwrap(const V8ScriptValue& val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptObjectV8Proxy::~ScriptObjectV8Proxy() {
|
ScriptObjectV8Proxy::~ScriptObjectV8Proxy() {
|
||||||
qDebug(scriptengine) << "Deleting object proxy: " << name();
|
if(_object) qDebug(scriptengine) << "Deleting object proxy: " << name();
|
||||||
if (_ownsObject) {
|
if (_ownsObject) {
|
||||||
QObject* qobject = _object;
|
QObject* qobject = _object;
|
||||||
if(qobject) qobject->deleteLater();
|
if(qobject) qobject->deleteLater();
|
||||||
|
@ -180,7 +184,7 @@ void ScriptObjectV8Proxy::investigate() {
|
||||||
|
|
||||||
const QMetaObject* metaObject = qobject->metaObject();
|
const QMetaObject* metaObject = qobject->metaObject();
|
||||||
|
|
||||||
qDebug(scriptengine) << "Investigate: " << metaObject->className();
|
//qDebug(scriptengine) << "Investigate: " << metaObject->className();
|
||||||
if (QString("Vec3") == metaObject->className()) {
|
if (QString("Vec3") == metaObject->className()) {
|
||||||
printf("Vec3");
|
printf("Vec3");
|
||||||
}
|
}
|
||||||
|
@ -194,7 +198,7 @@ void ScriptObjectV8Proxy::investigate() {
|
||||||
QMetaProperty prop = metaObject->property(idx);
|
QMetaProperty prop = metaObject->property(idx);
|
||||||
if (!prop.isScriptable()) continue;
|
if (!prop.isScriptable()) continue;
|
||||||
|
|
||||||
qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Property: " << prop.name();
|
//qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Property: " << prop.name();
|
||||||
// always exclude child objects (at least until we decide otherwise)
|
// always exclude child objects (at least until we decide otherwise)
|
||||||
int metaTypeId = prop.userType();
|
int metaTypeId = prop.userType();
|
||||||
if (metaTypeId != QMetaType::UnknownType) {
|
if (metaTypeId != QMetaType::UnknownType) {
|
||||||
|
@ -217,7 +221,7 @@ void ScriptObjectV8Proxy::investigate() {
|
||||||
QHash<V8ScriptString, int> methodNames;
|
QHash<V8ScriptString, int> methodNames;
|
||||||
for (int idx = startIdx; idx < num; ++idx) {
|
for (int idx = startIdx; idx < num; ++idx) {
|
||||||
QMetaMethod method = metaObject->method(idx);
|
QMetaMethod method = metaObject->method(idx);
|
||||||
qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Method: " << method.name();
|
//qDebug(scriptengine) << "Investigate: " << metaObject->className() << " Method: " << method.name();
|
||||||
|
|
||||||
// perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible
|
// perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible
|
||||||
/* if (method.access() != QMetaMethod::Public) continue;*/
|
/* if (method.access() != QMetaMethod::Public) continue;*/
|
||||||
|
@ -318,7 +322,7 @@ ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8Scrip
|
||||||
// check for methods
|
// check for methods
|
||||||
for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) {
|
for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) {
|
||||||
v8::String::Utf8Value methodNameStr(_engine->getIsolate(), trans.value().name.constGet());
|
v8::String::Utf8Value methodNameStr(_engine->getIsolate(), trans.value().name.constGet());
|
||||||
qDebug(scriptengine) << "queryProperty : " << *nameStr << " method: " << *methodNameStr;
|
//qDebug(scriptengine) << "queryProperty : " << *nameStr << " method: " << *methodNameStr;
|
||||||
if (!(trans.value().name == name)) continue;
|
if (!(trans.value().name == name)) continue;
|
||||||
*id = trans.key() | METHOD_TYPE;
|
*id = trans.key() | METHOD_TYPE;
|
||||||
return flags & (HandlesReadAccess | HandlesWriteAccess);
|
return flags & (HandlesReadAccess | HandlesWriteAccess);
|
||||||
|
|
|
@ -27,7 +27,9 @@ class QJsonValue;
|
||||||
inline bool isValidScale(glm::vec3 scale) {
|
inline bool isValidScale(glm::vec3 scale) {
|
||||||
bool result = scale.x != 0.0f && scale.y != 0.0f && scale.z != 0.0f;
|
bool result = scale.x != 0.0f && scale.y != 0.0f && scale.z != 0.0f;
|
||||||
// V8TODO: commented out for now
|
// V8TODO: commented out for now
|
||||||
qWarning() << "Scale is equal to 0";
|
if(!result){
|
||||||
|
qWarning() << "Scale is equal to 0";
|
||||||
|
}
|
||||||
// assert(result);
|
// assert(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue