mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Delete parents after base objects
* This fixes a potential crash deleting an image view after an image, by ensuring a non-owning pointer to the image's resinfo remains valid until after the image view is destroyed.
This commit is contained in:
@@ -213,10 +213,9 @@ void ResourceRecord::Delete(ResourceRecordHandler *mgr)
|
||||
RDCASSERT(ref >= 0);
|
||||
if(ref <= 0)
|
||||
{
|
||||
for(auto it = Parents.begin(); it != Parents.end(); ++it)
|
||||
(*it)->Delete(mgr);
|
||||
rdcarray<ResourceRecord *> ParentsToDelete;
|
||||
Parents.swap(ParentsToDelete);
|
||||
|
||||
Parents.clear();
|
||||
Length = 0;
|
||||
DataPtr = NULL;
|
||||
|
||||
@@ -226,5 +225,8 @@ void ResourceRecord::Delete(ResourceRecordHandler *mgr)
|
||||
mgr->RemoveResourceRecord(ResID);
|
||||
|
||||
mgr->DestroyResourceRecord(this);
|
||||
|
||||
for(auto it = ParentsToDelete.begin(); it != ParentsToDelete.end(); ++it)
|
||||
(*it)->Delete(mgr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user