Stereo Layers created in C++ shouldn’t require manual clean up at the end of a PIE session. They really should have a world context so that they die when the world shuts down.
As of right now, C++ created stereo layers that are not explicitly destroyed from one instance of a PIE session will immediately be visible in the next. In some situations, there’s limitations to the number of stereo layers that are available, and requesting a new layer past that throws no errors or warnings, either. In my case, I stumbled onto this fact because I’d attempted to make several layers with improper settings that were causing the layers to be invisible, but couldn’t see new layers after I fixed the settings because the bad broken ones were still hanging around.
I’ll admit that it was partially poor coding on my part. I still think a world context for the layers would be appropriate.