Skip to content

Commit

Permalink
Add debug output to pinpoint TearDown crash
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 12, 2022
1 parent e846a12 commit 0e1aa9e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
9 changes: 8 additions & 1 deletion radiantcore/modulesystem/ModuleRegistry.cpp
Expand Up @@ -205,7 +205,14 @@ void ModuleRegistry::shutdownModules()

for (ModulesMap::value_type& pair : _initialisedModules)
{
pair.second->shutdownModule();
try
{
pair.second->shutdownModule();
}
catch (const std::exception& ex)
{
std::cout << "Exception shutting down module " << pair.first << ": " << ex.what() << std::endl;
}
}

// Fire the signal before unloading the modules, clear the listeners afterwards
Expand Down
35 changes: 28 additions & 7 deletions test/RadiantTest.h
Expand Up @@ -117,17 +117,38 @@ class RadiantTest :

void TearDown() override
{
// Invoke any pre-shutdown custom code
preShutdown();
try
{
// Invoke any pre-shutdown custom code
preShutdown();
}
catch (const std::exception& ex)
{
std::cout << "Exception in TearDown::preShutdown(): " << ex.what() << std::endl;
}

_coreModule->get()->getMessageBus().removeListener(_notificationListener);
_coreModule->get()->getMessageBus().removeListener(_gameSetupListener);

// Issue a shutdown() call to all the modules
module::GlobalModuleRegistry().shutdownModules();

// Invoke any post-shutdown custom code
postShutdown();
try
{
// Issue a shutdown() call to all the modules
module::GlobalModuleRegistry().shutdownModules();
}
catch (const std::exception& ex)
{
std::cout << "Exception in TearDown.shutdownModules(): " << ex.what() << std::endl;
}

try
{
// Invoke any post-shutdown custom code
postShutdown();
}
catch (const std::exception& ex)
{
std::cout << "Exception in TearDown::postShutdown(): " << ex.what() << std::endl;
}
}

/// Override this to perform custom actions after the main module shuts down
Expand Down

0 comments on commit 0e1aa9e

Please sign in to comment.