1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Fix the "Crash on Exit" bug

We were throwing away the Dispatcher before all the keys (namely, leaked
keys) were unloaded. See the comment in plResManager for more details.
This commit is contained in:
2013-01-07 00:13:30 -05:00
parent 56f2ac69c4
commit b4f6ccaa88
4 changed files with 23 additions and 11 deletions

View File

@ -205,10 +205,11 @@ void plResManager::IShutdown()
// TimerCallbackMgr is a fixed-keyed object, so needs to shut down before the registry
plgTimerCallbackMgr::Shutdown();
// Destroy the dispatch. Note that we do this before the registry so that any lingering messages
// can free up keys properly
hsRefCnt_SafeUnRef(fDispatch);
fDispatch = nil;
// Formerly, we destroyed the Dispatcher here to clean up keys for leak reporting.
// However, if there are *real* leaked keys, then they will want to unload after this step.
// To unload, plKeyImp needs to dispatcher. SO, we're going to pitch everything currently in the
// Dispatcher and kill it later
fDispatch->BeginShutdown();
// Just before we shut down the registry, page out any keys that still exist.
// (They shouldn't... they're baaaaaad.)
@ -224,9 +225,12 @@ void plResManager::IShutdown()
fLoadedPages.clear();
IUnlockPages();
fLastFoundPage = nil;
// Now, kill off the Dispatcher
hsRefCnt_SafeUnRef(fDispatch);
fDispatch = nullptr;
kResMgrLog(1, ILog(1, " ...Shutdown successful!"));
fInited = false;