Common: Avoid buildup of blank callbacks.

This commit is contained in:
Unknown W. Brackets 2023-03-25 16:26:10 -07:00
parent 089580d09a
commit d621bbd73d

View File

@ -19,14 +19,14 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequestCallback c
int requestId = idCounter_++;
// NOTE: We need to register immediately, in order to support synchronous implementations.
{
if (callback || failedCallback) {
std::lock_guard<std::mutex> guard(callbackMutex_);
callbackMap_[requestId] = { callback, failedCallback };
}
INFO_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId);
if (!System_MakeRequest(type, requestId, param1, param2, param3)) {
{
if (callback || failedCallback) {
std::lock_guard<std::mutex> guard(callbackMutex_);
callbackMap_.erase(requestId);
}