diff --git a/libraries/animation/src/AnimationCache.cpp b/libraries/animation/src/AnimationCache.cpp index bf5ad233d6..7b15f0df26 100644 --- a/libraries/animation/src/AnimationCache.cpp +++ b/libraries/animation/src/AnimationCache.cpp @@ -47,6 +47,10 @@ AnimationReader::AnimationReader(const QUrl& url, const QByteArray& data) : } void AnimationReader::run() { + auto originalPriority = QThread::currentThread()->priority(); + if (originalPriority == QThread::InheritPriority) { + originalPriority = QThread::NormalPriority; + } try { if (_data.isEmpty()) { throw QString("Reply is NULL ?!"); @@ -73,6 +77,7 @@ void AnimationReader::run() { } catch (const QString& error) { emit onError(299, error); } + QThread::currentThread()->setPriority(originalPriority); } bool Animation::isLoaded() const { diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index 2b425351f1..c4dc7ebccf 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -50,6 +50,11 @@ GeometryReader::GeometryReader(const QUrl& url, const QByteArray& data, const QV } void GeometryReader::run() { + auto originalPriority = QThread::currentThread()->priority(); + if (originalPriority == QThread::InheritPriority) { + originalPriority = QThread::NormalPriority; + } + QThread::currentThread()->setPriority(QThread::LowPriority); try { if (_data.isEmpty()) { throw QString("Reply is NULL ?!"); @@ -82,6 +87,8 @@ void GeometryReader::run() { qCDebug(modelnetworking) << "Error reading " << _url << ": " << error; emit onError(NetworkGeometry::ModelParseError, error); } + + QThread::currentThread()->setPriority(originalPriority); } NetworkGeometry::NetworkGeometry(const QUrl& url, bool delayLoad, const QVariantHash& mapping, const QUrl& textureBaseUrl) : diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index 60f6d50d59..8201339e93 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -268,6 +268,12 @@ void ImageReader::listSupportedImageFormats() { } void ImageReader::run() { + auto originalPriority = QThread::currentThread()->priority(); + if (originalPriority == QThread::InheritPriority) { + originalPriority = QThread::NormalPriority; + } + QThread::currentThread()->setPriority(QThread::LowPriority); + auto texture = _texture.toStrongRef(); if (!texture) { qCWarning(modelnetworking) << "Could not get strong ref"; @@ -306,6 +312,7 @@ void ImageReader::run() { Q_ARG(const QImage&, image), Q_ARG(void*, theTexture), Q_ARG(int, originalWidth), Q_ARG(int, originalHeight)); + QThread::currentThread()->setPriority(originalPriority); } void NetworkTexture::setImage(const QImage& image, void* voidTexture, int originalWidth,