mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-11 21:52:26 +02:00
Merge pull request #3462 from Atlante45/fix_attachment_bug_with_recording
Fixes concurrency issue with ScriptEngine timers
This commit is contained in:
commit
631171eb2e
3 changed files with 13 additions and 9 deletions
|
@ -877,7 +877,9 @@ void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
|
||||
void Avatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
|
||||
AvatarData::setAttachmentData(attachmentData);
|
||||
if (QThread::currentThread() != thread()) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setAttachmentData", Qt::DirectConnection,
|
||||
Q_ARG(const QVector<AttachmentData>, attachmentData));
|
||||
return;
|
||||
}
|
||||
// make sure we have as many models as attachments
|
||||
|
@ -892,9 +894,9 @@ void Avatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
|
|||
|
||||
// update the urls
|
||||
for (int i = 0; i < attachmentData.size(); i++) {
|
||||
_attachmentModels[i]->setURL(attachmentData.at(i).modelURL);
|
||||
_attachmentModels[i]->setSnapModelToCenter(true);
|
||||
_attachmentModels[i]->setScaleToFit(true, _scale * _attachmentData.at(i).scale);
|
||||
_attachmentModels[i]->setURL(attachmentData.at(i).modelURL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1029,7 +1029,9 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
|
||||
void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
|
||||
Avatar::setAttachmentData(attachmentData);
|
||||
if (QThread::currentThread() != thread()) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setAttachmentData", Qt::DirectConnection,
|
||||
Q_ARG(const QVector<AttachmentData>, attachmentData));
|
||||
return;
|
||||
}
|
||||
_billboardValid = false;
|
||||
|
|
|
@ -605,18 +605,18 @@ void ScriptEngine::stop() {
|
|||
|
||||
void ScriptEngine::timerFired() {
|
||||
QTimer* callingTimer = reinterpret_cast<QTimer*>(sender());
|
||||
|
||||
// call the associated JS function, if it exists
|
||||
QScriptValue timerFunction = _timerFunctionMap.value(callingTimer);
|
||||
if (timerFunction.isValid()) {
|
||||
timerFunction.call();
|
||||
}
|
||||
|
||||
|
||||
if (!callingTimer->isActive()) {
|
||||
// this timer is done, we can kill it
|
||||
_timerFunctionMap.remove(callingTimer);
|
||||
delete callingTimer;
|
||||
}
|
||||
|
||||
// call the associated JS function, if it exists
|
||||
if (timerFunction.isValid()) {
|
||||
timerFunction.call();
|
||||
}
|
||||
}
|
||||
|
||||
QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int intervalMS, bool isSingleShot) {
|
||||
|
|
Loading…
Reference in a new issue