mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 12:24:01 +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;
|
||||
|
||||
AssetClient::AssetClient() {
|
||||
|
||||
setCustomDeleter([](Dependency* dependency){
|
||||
static_cast<AssetClient*>(dependency)->deleteLater();
|
||||
});
|
||||
|
@ -502,7 +501,18 @@ bool AssetClient::cancelGetAssetInfoRequest(MessageID id) {
|
|||
bool AssetClient::cancelGetAssetRequest(MessageID id) {
|
||||
// Search through each pending mapping request for id `id`
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue