Fix recursive invokes of ResourceCache::prefetch

This commit is contained in:
Zach Pomerantz 2016-04-21 17:15:11 -07:00
parent 4df417e756
commit 069065dc23
2 changed files with 7 additions and 7 deletions

View file

@ -162,7 +162,8 @@ ScriptableResource* ResourceCache::prefetch(const QUrl& url, void* extra) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
// Must be called in thread to ensure getResource returns a valid pointer // Must be called in thread to ensure getResource returns a valid pointer
QMetaObject::invokeMethod(this, "prefetch", Qt::BlockingQueuedConnection, 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; return result;
} }

View file

@ -168,6 +168,11 @@ public slots:
protected slots: protected slots:
void updateTotalSize(const qint64& deltaSize); 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: private slots:
void clearATPAssets(); void clearATPAssets();
@ -178,12 +183,6 @@ protected:
// the QScriptEngine will delete the pointer when it is garbage collected. // the QScriptEngine will delete the pointer when it is garbage collected.
Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url) { return prefetch(url, nullptr); } 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. /// Loads a resource from the specified URL.
/// \param fallback a fallback URL to load if the desired one is unavailable /// \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 /// \param delayLoad if true, don't load the resource immediately; wait until load is first requested