mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 17:22:40 +02:00
Fixed object deletion event, temporarily disabled watchdog log commands to make reading logs easier
This commit is contained in:
parent
0d454eb6e8
commit
6301d23c48
6 changed files with 35 additions and 23 deletions
|
@ -448,38 +448,38 @@ public:
|
|||
|
||||
if (elapsedMovingAverage > _maxElapsedAverage * 1.1f) {
|
||||
#if !defined(NDEBUG)
|
||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||
/* qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
||||
<< "maxElapsed:" << _maxElapsed
|
||||
<< "PREVIOUS maxElapsedAverage:" << _maxElapsedAverage
|
||||
<< "NEW maxElapsedAverage:" << elapsedMovingAverage << "** NEW MAX ELAPSED AVERAGE **"
|
||||
<< "samples:" << _movingAverage.getSamples();
|
||||
<< "samples:" << _movingAverage.getSamples();*/
|
||||
#endif
|
||||
_maxElapsedAverage = elapsedMovingAverage;
|
||||
}
|
||||
if (lastHeartbeatAge > _maxElapsed) {
|
||||
#if !defined(NDEBUG)
|
||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||
/* qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||
<< "elapsedMovingAverage:" << elapsedMovingAverage
|
||||
<< "PREVIOUS maxElapsed:" << _maxElapsed
|
||||
<< "NEW maxElapsed:" << lastHeartbeatAge << "** NEW MAX ELAPSED **"
|
||||
<< "maxElapsedAverage:" << _maxElapsedAverage
|
||||
<< "samples:" << _movingAverage.getSamples();
|
||||
<< "samples:" << _movingAverage.getSamples();*/
|
||||
#endif
|
||||
_maxElapsed = lastHeartbeatAge;
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) {
|
||||
/* if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) {
|
||||
qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:"
|
||||
<< "lastHeartbeatAge:" << lastHeartbeatAge
|
||||
<< "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **"
|
||||
<< "maxElapsed:" << _maxElapsed
|
||||
<< "maxElapsedAverage:" << _maxElapsedAverage
|
||||
<< "samples:" << _movingAverage.getSamples();
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
|
||||
if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) {
|
||||
|
|
|
@ -187,7 +187,7 @@ void GraphicsEngine::render_performFrame() {
|
|||
|
||||
{
|
||||
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
|
||||
if (!displayPlugin->beginFrameRender(_renderFrameCount)) {
|
||||
QMetaObject::invokeMethod(qApp, "updateDisplayMode");
|
||||
|
@ -267,7 +267,7 @@ void GraphicsEngine::render_performFrame() {
|
|||
PROFILE_RANGE(render, "/renderOverlay");
|
||||
PerformanceTimer perfTimer("renderOverlay");
|
||||
// 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());
|
||||
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);
|
||||
bool castValueToVariant(const V8ScriptValue& val, QVariant& dest, int destTypeId);
|
||||
V8ScriptValue castVariantToValue(const QVariant& val);
|
||||
static QString valueType(const V8ScriptValue& val);
|
||||
QString valueType(const V8ScriptValue& val);
|
||||
v8::Isolate* getIsolate() {return _v8Isolate;}
|
||||
v8::Local<v8::Context> getContext() {
|
||||
v8::EscapableHandleScope handleScope(_v8Isolate);
|
||||
|
|
|
@ -315,6 +315,7 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
|||
return true;
|
||||
}
|
||||
|
||||
QString errorMessage("");
|
||||
// do we have a registered handler for this type?
|
||||
ScriptEngine::DemarshalFunction demarshalFunc = nullptr;
|
||||
{
|
||||
|
@ -473,8 +474,10 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
|||
break;
|
||||
}
|
||||
}
|
||||
// V8TODO maybe export as JSON and then convert from JSON to QVariant?
|
||||
Q_ASSERT(false);
|
||||
errorMessage = QString() + "Conversion to variant failed: " + QString(*v8::String::Utf8Value(_v8Isolate, val->ToDetailString(getConstContext()).ToLocalChecked()))
|
||||
+ " Destination type: " + QMetaType::typeName(destTypeId);
|
||||
qDebug() << errorMessage;
|
||||
break;
|
||||
default:
|
||||
// check to see if this is a pointer to a QObject-derived object
|
||||
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)
|
||||
// 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);
|
||||
qDebug() << errorMessage;
|
||||
if(destTypeId == QMetaType::QVariant) {
|
||||
|
@ -550,9 +553,12 @@ QString ScriptEngineV8::valueType(const V8ScriptValue& v8Val) {
|
|||
return var.typeName();
|
||||
}
|
||||
}
|
||||
//V8TODO
|
||||
Q_ASSERT(false);
|
||||
//return val->toVariant().typeName();
|
||||
QVariant dest;
|
||||
if (castValueToVariant(v8Val, dest, QMetaType::QVariant)) {
|
||||
return dest.typeName();
|
||||
}
|
||||
qDebug() << "Cast to variant failed";
|
||||
// V8TODO: what to return here?
|
||||
return "undefined";
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o
|
|||
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
|
||||
engine->_qobjectWrapperMap.insert(object, proxy);
|
||||
engine->_qobjectWrapperMapV8.insert(object, proxy);
|
||||
|
@ -126,6 +126,10 @@ V8ScriptValue ScriptObjectV8Proxy::newQObject(ScriptEngineV8* engine, QObject* o
|
|||
if (lookup != enginePtr->_qobjectWrapperMap.end()) {
|
||||
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()));
|
||||
auto v8Value = val.constGet();
|
||||
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;
|
||||
}
|
||||
v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value);
|
||||
|
@ -159,7 +163,7 @@ QObject* ScriptObjectV8Proxy::unwrap(const V8ScriptValue& val) {
|
|||
}
|
||||
|
||||
ScriptObjectV8Proxy::~ScriptObjectV8Proxy() {
|
||||
qDebug(scriptengine) << "Deleting object proxy: " << name();
|
||||
if(_object) qDebug(scriptengine) << "Deleting object proxy: " << name();
|
||||
if (_ownsObject) {
|
||||
QObject* qobject = _object;
|
||||
if(qobject) qobject->deleteLater();
|
||||
|
@ -180,7 +184,7 @@ void ScriptObjectV8Proxy::investigate() {
|
|||
|
||||
const QMetaObject* metaObject = qobject->metaObject();
|
||||
|
||||
qDebug(scriptengine) << "Investigate: " << metaObject->className();
|
||||
//qDebug(scriptengine) << "Investigate: " << metaObject->className();
|
||||
if (QString("Vec3") == metaObject->className()) {
|
||||
printf("Vec3");
|
||||
}
|
||||
|
@ -194,7 +198,7 @@ void ScriptObjectV8Proxy::investigate() {
|
|||
QMetaProperty prop = metaObject->property(idx);
|
||||
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)
|
||||
int metaTypeId = prop.userType();
|
||||
if (metaTypeId != QMetaType::UnknownType) {
|
||||
|
@ -217,7 +221,7 @@ void ScriptObjectV8Proxy::investigate() {
|
|||
QHash<V8ScriptString, int> methodNames;
|
||||
for (int idx = startIdx; idx < num; ++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
|
||||
/* if (method.access() != QMetaMethod::Public) continue;*/
|
||||
|
@ -318,7 +322,7 @@ ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8Scrip
|
|||
// check for methods
|
||||
for (MethodDefMap::const_iterator trans = _methods.cbegin(); trans != _methods.cend(); ++trans) {
|
||||
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;
|
||||
*id = trans.key() | METHOD_TYPE;
|
||||
return flags & (HandlesReadAccess | HandlesWriteAccess);
|
||||
|
|
|
@ -27,7 +27,9 @@ class QJsonValue;
|
|||
inline bool isValidScale(glm::vec3 scale) {
|
||||
bool result = scale.x != 0.0f && scale.y != 0.0f && scale.z != 0.0f;
|
||||
// V8TODO: commented out for now
|
||||
qWarning() << "Scale is equal to 0";
|
||||
if(!result){
|
||||
qWarning() << "Scale is equal to 0";
|
||||
}
|
||||
// assert(result);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue