fix(renderer): guard ImageManager callback against use-after-free (#4233)

This commit is contained in:
Jonas
2026-05-12 12:50:19 +02:00
committed by GitHub
parent 9faee4790b
commit 6b9b342bf3
10 changed files with 116 additions and 116 deletions

View File

@@ -260,10 +260,12 @@ void ImageManager::checkMissingAndNotify(ImageRequestor& requestor, const ImageR
requestor.addPendingRequest(missingImage);
}
auto removePendingRequests = [this, missingImage] {
std::scoped_lock readWriteLock(rwLock);
auto existingRequest = requestedImages.find(missingImage);
if (existingRequest == requestedImages.end()) {
auto removePendingRequests = [weakSelf = weak_from_this(), missingImage] {
auto self = weakSelf.lock();
if (!self) return;
std::scoped_lock readWriteLock(self->rwLock);
auto existingRequest = self->requestedImages.find(missingImage);
if (existingRequest == self->requestedImages.end()) {
return;
}