Merge pull request #83782 from timothyqiu/self-awareness

Fix heap-use-after-free when resource loaded with `load_threaded_request` is never fetched
This commit is contained in:
Rémi Verschelde 2023-10-24 10:54:31 +02:00
commit a1fd0b9d8a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 2 deletions

View File

@ -1053,8 +1053,9 @@ void ResourceLoader::clear_thread_load_tasks() {
thread_load_mutex.lock();
}
for (KeyValue<String, LoadToken *> &E : user_load_tokens) {
memdelete(E.value);
while (user_load_tokens.begin()) {
// User load tokens remove themselves from the map on destruction.
memdelete(user_load_tokens.begin()->value);
}
user_load_tokens.clear();