From 069065dc23a7e66f32aa896dc22b3a165e69c4b5 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Thu, 21 Apr 2016 17:15:11 -0700 Subject: [PATCH] Fix recursive invokes of ResourceCache::prefetch --- libraries/networking/src/ResourceCache.cpp | 3 ++- libraries/networking/src/ResourceCache.h | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 83fcc90a4d..2bd85ce5d2 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -162,7 +162,8 @@ ScriptableResource* ResourceCache::prefetch(const QUrl& url, void* extra) { if (QThread::currentThread() != thread()) { // Must be called in thread to ensure getResource returns a valid pointer QMetaObject::invokeMethod(this, "prefetch", Qt::BlockingQueuedConnection, - Q_RETURN_ARG(ScriptableResource*, result), Q_ARG(QUrl, url)); + Q_RETURN_ARG(ScriptableResource*, result), + Q_ARG(QUrl, url), Q_ARG(void*, extra)); return result; } diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 1461094cfb..7d9e0f65fd 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -168,6 +168,11 @@ public slots: protected slots: void updateTotalSize(const qint64& deltaSize); + // Prefetches a resource to be held by the QScriptEngine. + // Left as a protected member so subclasses can overload prefetch + // and delegate to it (see TextureCache::prefetch(const QUrl&, int). + ScriptableResource* prefetch(const QUrl& url, void* extra); + private slots: void clearATPAssets(); @@ -178,12 +183,6 @@ protected: // the QScriptEngine will delete the pointer when it is garbage collected. Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url) { return prefetch(url, nullptr); } - - // Prefetches a resource to be held by the QScriptEngine. - // Left as a protected member so subclasses can overload prefetch - // and delegate to it (see TextureCache::prefetch(const QUrl&, int). - ScriptableResource* prefetch(const QUrl& url, void* extra); - /// Loads a resource from the specified URL. /// \param fallback a fallback URL to load if the desired one is unavailable /// \param delayLoad if true, don't load the resource immediately; wait until load is first requested