Currently in atlasUI we are using two different "Games", one for simulation and map, and the other one for see an entity.
there are some facts we need to keep in mind for this proposal:
- AtlasUI (with atlas) use "custom Loop" to handle all redenfring and update
- AtlasViewer and GameViewer are sharing Renderer
- The loop use to have a component TerrainRenderer that use state "phase_submit" and then "phase_render"
- Currently there is a timer(wxTimer) in atlasUI that trigger that custom render loop
- Custom render loop have a pointer for "current" view
- When you hit the option "Switch to Actor Viewer" internally atlasUI send a "MESSAGE" to engine to change the "current" view
there were another bugs with "generate random maps" but it was solved setting the tools to default (ActorViewer in atlas work like a "tool") you can see in trac.
with all in mind there is a bug with that switch but isnot able to always reproduce, the reason is because there is a use case when the timer trigger the "renderloop" and the user at the same time hit the button to "Swtich to actor Viewer" and then TerrainRenderer start to popup messages (because ENSURE(m->phase == Phase_Submit)) and crash your game;
MY PROPOSAL:
when the use hit the button to switch the view, the code is going to stop the rendering loop, wait some miliseconds just to allow any current renderloop finalize, and then change the view and resume the redering loop.
this is not perfect put help us to prevent any error related to share Renderer components, but also an "easy fix" for all "hacky" code in atlasUI.