mirror of
https://github.com/overte-org/overte.git
synced 2025-06-26 10:50:39 +02:00
Fix AssetRequest crash where signal was not disconnected
This commit is contained in:
parent
8631fa6cd3
commit
63d98b1b5c
1 changed files with 12 additions and 2 deletions
|
@ -32,7 +32,6 @@
|
||||||
MessageID AssetClient::_currentID = 0;
|
MessageID AssetClient::_currentID = 0;
|
||||||
|
|
||||||
AssetClient::AssetClient() {
|
AssetClient::AssetClient() {
|
||||||
|
|
||||||
setCustomDeleter([](Dependency* dependency){
|
setCustomDeleter([](Dependency* dependency){
|
||||||
static_cast<AssetClient*>(dependency)->deleteLater();
|
static_cast<AssetClient*>(dependency)->deleteLater();
|
||||||
});
|
});
|
||||||
|
@ -502,7 +501,18 @@ bool AssetClient::cancelGetAssetInfoRequest(MessageID id) {
|
||||||
bool AssetClient::cancelGetAssetRequest(MessageID id) {
|
bool AssetClient::cancelGetAssetRequest(MessageID id) {
|
||||||
// Search through each pending mapping request for id `id`
|
// Search through each pending mapping request for id `id`
|
||||||
for (auto& kv : _pendingRequests) {
|
for (auto& kv : _pendingRequests) {
|
||||||
if (kv.second.erase(id)) {
|
auto& messageCallbackMap = kv.second;
|
||||||
|
auto requestIt = messageCallbackMap.find(id);
|
||||||
|
if (requestIt != kv.second.end()) {
|
||||||
|
|
||||||
|
auto& message = requestIt->second.message;
|
||||||
|
if (message) {
|
||||||
|
// disconnect from all signals emitting from the pending message
|
||||||
|
disconnect(message.data(), nullptr, this, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
messageCallbackMap.erase(requestIt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue