mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Unload all keys of all pages before deleting them
(ported from H-uru/Plasma@04d0ac94ea)
This commit is contained in:
@ -219,14 +219,20 @@ void plResManager::IShutdown()
|
|||||||
// Shut down the registry (finally!)
|
// Shut down the registry (finally!)
|
||||||
ILockPages();
|
ILockPages();
|
||||||
|
|
||||||
PageSet::const_iterator it;
|
// Unload all keys before actually deleting the pages.
|
||||||
for (it = fAllPages.begin(); it != fAllPages.end(); it++)
|
// When a key's refcount drops to zero, IKeyUnreffed looks up the key's page.
|
||||||
delete *it;
|
// If the page is already deleted at that point, this causes a use after free and potential crash.
|
||||||
fAllPages.clear();
|
for (PageSet::const_iterator it = fAllPages.begin(); it != fAllPages.end(); it++) {
|
||||||
|
(*it)->UnloadKeys();
|
||||||
|
}
|
||||||
fLoadedPages.clear();
|
fLoadedPages.clear();
|
||||||
|
fLastFoundPage = nil;
|
||||||
|
for (PageSet::const_iterator it = fAllPages.begin(); it != fAllPages.end(); it++) {
|
||||||
|
delete *it;
|
||||||
|
}
|
||||||
|
fAllPages.clear();
|
||||||
|
|
||||||
IUnlockPages();
|
IUnlockPages();
|
||||||
fLastFoundPage = nil;
|
|
||||||
|
|
||||||
// Now, kill off the Dispatcher
|
// Now, kill off the Dispatcher
|
||||||
hsRefCnt_SafeUnRef(fDispatch);
|
hsRefCnt_SafeUnRef(fDispatch);
|
||||||
|
Reference in New Issue
Block a user