mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Fix the "Crash on Exit" bug (cherry picked from commit b4f6ccaa88
)
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:
@ -68,6 +68,8 @@ public:
|
|||||||
virtual void MsgQueueOnOff(hsBool) = 0; // Turn on or off Queued Messages, if off, uses MsgSend Immediately (for plugins)
|
virtual void MsgQueueOnOff(hsBool) = 0; // Turn on or off Queued Messages, if off, uses MsgSend Immediately (for plugins)
|
||||||
|
|
||||||
virtual hsBool SetMsgBuffering(hsBool on) = 0; // On starts deferring msg delivery until buffering is set to off again.
|
virtual hsBool SetMsgBuffering(hsBool on) = 0; // On starts deferring msg delivery until buffering is set to off again.
|
||||||
|
|
||||||
|
virtual bool BeginShutdown() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,12 +103,14 @@ plDispatch::plDispatch()
|
|||||||
|
|
||||||
plDispatch::~plDispatch()
|
plDispatch::~plDispatch()
|
||||||
{
|
{
|
||||||
int i;
|
hsAssert(fRegisteredExactTypes.GetCount() == 0, "registered type after Dispatch shutdown");
|
||||||
for( i = 0; i < fRegisteredExactTypes.GetCount(); i++ )
|
|
||||||
delete fRegisteredExactTypes[i];
|
|
||||||
|
|
||||||
ITrashUndelivered();
|
ITrashUndelivered();
|
||||||
|
}
|
||||||
|
|
||||||
|
void plDispatch::BeginShutdown()
|
||||||
|
{
|
||||||
|
fRegisteredExactTypes.Reset();
|
||||||
|
ITrashUndelivered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void plDispatch::ITrashUndelivered()
|
void plDispatch::ITrashUndelivered()
|
||||||
|
@ -131,6 +131,8 @@ public:
|
|||||||
|
|
||||||
virtual hsBool SetMsgBuffering(hsBool on); // On starts deferring msg delivery until buffering is set to off again.
|
virtual hsBool SetMsgBuffering(hsBool on); // On starts deferring msg delivery until buffering is set to off again.
|
||||||
|
|
||||||
|
virtual void BeginShutdown();
|
||||||
|
|
||||||
static void SetMsgRecieveCallback(MsgRecieveCallback callback) { fMsgRecieveCallback = callback; }
|
static void SetMsgRecieveCallback(MsgRecieveCallback callback) { fMsgRecieveCallback = callback; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,10 +205,12 @@ void plResManager::IShutdown()
|
|||||||
// TimerCallbackMgr is a fixed-keyed object, so needs to shut down before the registry
|
// TimerCallbackMgr is a fixed-keyed object, so needs to shut down before the registry
|
||||||
plgTimerCallbackMgr::Shutdown();
|
plgTimerCallbackMgr::Shutdown();
|
||||||
|
|
||||||
// Destroy the dispatch. Note that we do this before the registry so that any lingering messages
|
// Formerly, we destroyed the Dispatcher here to clean up keys for leak reporting.
|
||||||
// can free up keys properly
|
// However, if there are *real* leaked keys, then they will want to unload after this step.
|
||||||
hsRefCnt_SafeUnRef(fDispatch);
|
// To unload, plKeyImp needs to dispatcher. SO, we're going to pitch everything currently in the
|
||||||
fDispatch = nil;
|
// Dispatcher and kill it later
|
||||||
|
fDispatch->BeginShutdown();
|
||||||
|
|
||||||
|
|
||||||
// Just before we shut down the registry, page out any keys that still exist.
|
// Just before we shut down the registry, page out any keys that still exist.
|
||||||
// (They shouldn't... they're baaaaaad.)
|
// (They shouldn't... they're baaaaaad.)
|
||||||
@ -224,9 +226,12 @@ void plResManager::IShutdown()
|
|||||||
fLoadedPages.clear();
|
fLoadedPages.clear();
|
||||||
|
|
||||||
IUnlockPages();
|
IUnlockPages();
|
||||||
|
|
||||||
fLastFoundPage = nil;
|
fLastFoundPage = nil;
|
||||||
|
|
||||||
|
// Now, kill off the Dispatcher
|
||||||
|
hsRefCnt_SafeUnRef(fDispatch);
|
||||||
|
fDispatch = nil;
|
||||||
|
|
||||||
kResMgrLog(1, ILog(1, " ...Shutdown successful!"));
|
kResMgrLog(1, ILog(1, " ...Shutdown successful!"));
|
||||||
|
|
||||||
fInited = false;
|
fInited = false;
|
||||||
|
Reference in New Issue
Block a user