Closed dkrautha closed 3 years ago
Solution for Failure 2: We were calling GLWin's cleanup() function twice, once at the end of the mainloop, and another in the destructor of GLWin. This led to calling glDeleteProgram() again on something a program that had already been deleted giving a segfault.
There are two options to fix this, either remove the mainloop call or the destructor call. The correct choice was to remove the destructor call as after calling cleanup in the mainloop, glfwTerminate is called which likely destroys the opengl context, and caused an immediate segfault in the destructor (you can't call an opengl function without an opengl context).
I started walking through where things are dying when we try to quit, here's what I've found so far:
Solution: Initialize cam to nullptr in the constructor of Canvas, and then check whether it is a nullptr before we try and delete it.
I'm not sure what to do to solve this, simply commenting out the glDeleteProgram() call does work, but it probably causes us to leak memory.