mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-11 19:32:28 +02:00
Merge pull request #7877 from Atlante45/fix/asset-client
Fix Asset Client crash
This commit is contained in:
commit
67891abf17
7 changed files with 17 additions and 11 deletions
|
@ -1,3 +1,3 @@
|
|||
set(TARGET_NAME animation)
|
||||
setup_hifi_library(Network Script)
|
||||
link_hifi_libraries(shared gpu model fbx)
|
||||
link_hifi_libraries(shared model fbx)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
set(TARGET_NAME entities-renderer)
|
||||
AUTOSCRIBE_SHADER_LIB(gpu model render render-utils)
|
||||
setup_hifi_library(Widgets Network Script)
|
||||
link_hifi_libraries(shared gpu procedural model model-networking script-engine render render-utils gl)
|
||||
link_hifi_libraries(shared gpu procedural model model-networking script-engine render render-utils)
|
||||
|
||||
target_bullet()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set(TARGET_NAME entities)
|
||||
setup_hifi_library(Network Script)
|
||||
link_hifi_libraries(avatars shared audio octree gpu model fbx networking animation)
|
||||
link_hifi_libraries(avatars shared audio octree model fbx networking animation)
|
||||
|
||||
target_bullet()
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
set(TARGET_NAME fbx)
|
||||
setup_hifi_library()
|
||||
link_hifi_libraries(shared gpu model networking octree)
|
||||
link_hifi_libraries(shared model networking)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(TARGET_NAME model-networking)
|
||||
setup_hifi_library()
|
||||
link_hifi_libraries(shared networking gpu model fbx)
|
||||
link_hifi_libraries(shared networking model fbx)
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ AssetUpload* AssetClient::createUpload(const QByteArray& data) {
|
|||
}
|
||||
|
||||
MessageID AssetClient::getAsset(const QString& hash, DataOffset start, DataOffset end,
|
||||
ReceivedAssetCallback callback, ProgressCallback progressCallback) {
|
||||
ReceivedAssetCallback callback, ProgressCallback progressCallback) {
|
||||
Q_ASSERT(QThread::currentThread() == thread());
|
||||
|
||||
if (hash.length() != SHA256_HASH_HEX_LENGTH) {
|
||||
|
@ -238,8 +238,6 @@ MessageID AssetClient::getAsset(const QString& hash, DataOffset start, DataOffse
|
|||
callback(false, AssetServerError::NoError, QByteArray());
|
||||
return INVALID_MESSAGE_ID;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
MessageID AssetClient::getAssetInfo(const QString& hash, GetInfoCallback callback) {
|
||||
|
|
|
@ -106,9 +106,13 @@ void AssetRequest::start() {
|
|||
int start = 0, end = _info.size;
|
||||
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
auto that = QPointer<AssetRequest>(this); // Used to track the request's lifetime
|
||||
_assetRequestID = assetClient->getAsset(_hash, start, end,
|
||||
[this, start, end](bool responseReceived, AssetServerError serverError, const QByteArray& data) {
|
||||
|
||||
[this, that, start, end](bool responseReceived, AssetServerError serverError, const QByteArray& data) {
|
||||
if (!that) {
|
||||
// If the request is dead, return
|
||||
return;
|
||||
}
|
||||
_assetRequestID = AssetClient::INVALID_MESSAGE_ID;
|
||||
|
||||
if (!responseReceived) {
|
||||
|
@ -148,7 +152,11 @@ void AssetRequest::start() {
|
|||
|
||||
_state = Finished;
|
||||
emit finished(this);
|
||||
}, [this](qint64 totalReceived, qint64 total) {
|
||||
}, [this, that](qint64 totalReceived, qint64 total) {
|
||||
if (!that) {
|
||||
// If the request is dead, return
|
||||
return;
|
||||
}
|
||||
emit progress(totalReceived, total);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue