Assert on exit in ShadowMapManager

Expanding and utilizing the engine via C++.
2 posts Page 1 of 1
Happenstance
Posts: 10
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Fri Jun 30, 2017 3:36 am
Posting this here instead of creating a new issue on github because I'm not exactly sure why this happens (or rather, why it doesn't happen in a stock build of T3D).

In my build (based off of the latest dev branch with these changes to remove Basic Lighting) I get an assert when exiting the engine:
ShadowMapManager::instance() - The singleton has not been created!


The problem seems to be caused by ShadowMapManager being destroyed before AdvancedLightManager. The callstack looks something like this:

// This causes ShadowMapManager's MODULE_SHUTDOWN macro to run which calls ShadowMapManager::deleteSingleton().
EngineModuleManager::shutdownSystem()
..
..
// This calls SHADOWMGR->deactivate(). SHADOWMGR is simply a #define pointing to, you guessed it, ShadowMapManager's singleton instance. Assert time!
AdvancedLightManager::deactivate()


I can fix this in my build by adding the following to ShadowMapManager's MODULE_BEGIN definition:

MODULE_SHUTDOWN_AFTER(Scene)


This delays the shutdown of ShadowMapManager until the SceneManager has been destroyed which ensures AdvancedLightManager has also been destroyed. What I can't figure out is why this doesn't happen in stock T3D. Removing Basic Lighting seems to be related to this but I have no idea why.
JeffR
Steering Committee
Steering Committee
Posts: 750
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Tue Jul 11, 2017 4:43 am
Looking at this again, I want to say I'd run into something similar a good while back, where tweaking the module cleanup order helped resolve a problem, but I don't remember the particulars.

I'll keep an eye towards this, in case anything that seems related pops up. If I spot anything, I can post an update here, but I think for now the module re-order fix is probably a sufficient one. it shouldn't really impact anything negatively.
2 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests