How to avoid one C++ foot gun
pboyd.io
pboyd.io
I did see your issue immediately, though, and I could remember having the same issue with my own code. I remember assigning Shaders into a shader manager. They were already dead.
These days I prefer to in-place construct most things, unless there's a particular reason for assignment.
C++ is not Java. The first thing to learn is where things get allocated and how copying works, which is quite different from "almost-everything-in-the-heap" languages.
All you need is this: