I finally managed to track down the reason why irrlicht segfaults on exit when GLSL shaders are used. The context is destroyed before the shaders are freed!
Thus glGetAttachedObjects doesn't do anything to count, which then gets set to random memory, irrlicht tries to access the shaders[8] array beyond 8 -> segfault.
The quick fix -> initialize count to 0 in COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer().
The proper fix -> don't rely on C++ garbage collection here, free all OpenGL resources before destroying the context.


