-
Notifications
You must be signed in to change notification settings - Fork 177
Set resource total size to content size when using a qrc:// resource #1068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When a Resource is requested from qrc://, the Resource::handleDownloadProgress event is never called, and therefore _bytesTotal remains at zero. This confuses ResourceCache later, which has a sanity check that doesn't pass when resources are retrieved, yet no data accumulates. Fixes vircadia#1065
@@ -809,6 +807,14 @@ void Resource::handleReplyFinished() { | |||
} | |||
|
|||
auto data = _request->getData(); | |||
if (_request->getUrl().scheme() == "qrc") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure if this check is necessary. It may be perfectly safe to do it always
_bytesTotal = data.length(); | ||
} | ||
|
||
setSize(_bytesTotal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note we're not calling setSize in the case of failure anymore.
I think this should be fine since on failure no data arrives, and this can cause confusion in ResourceCache.
The following links are available: build (ubuntu-18.04, full)
build (windows-latest, full) build (ubuntu-18.04, android) |
What might be a good way to test this to confirm it works? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tutorial and Hub worked fine with this PR.
When a Resource is requested from qrc://, the Resource::handleDownloadProgress
event is never called, and therefore _bytesTotal remains at zero. This confuses
ResourceCache later, which has a sanity check that doesn't pass when resources
are retrieved, yet no data accumulates.
Fixes #1065