Closing secondary window (via close()) causes ci::gl::ScopedFramebuffer to crash


Hey Embers,

I’m facing an odd situation…

I’m wondering if anyone else has messed around a bit with more than one windows while using FrameBufferObjects. My application is primarily single threaded, and I’m actively rendering some visuals on to textures using various FBOs. All of these were created in the primary OpenGL context, and I’m aware that an FBO cannot be shared among two OpenGL contexts. Thus I rely on textures to render the contents.

If I close the secondary window using the close();, the program crashes. If I click the x in the top right, then it doesn’t. The place it crashes specifically is Lin 1557 in Context.cpp - the reference to the std::vector referenced by the stack variable is seemingly gone.

The final call-stack in cinder is as follows:

PlanMixPlay.exe!cinder::gl::Context::pushStackState<int>(std::vector<int,std::allocator<int> > & stack, int value) Line 1557	C++
PlanMixPlay.exe!cinder::gl::Context::pushFramebuffer(unsigned int target, unsigned int framebuffer) Line 1092	C++
PlanMixPlay.exe!cinder::gl::Context::pushFramebuffer(const std::shared_ptr<cinder::gl::Fbo> & fbo, unsigned int target) Line 1082	C++
PlanMixPlay.exe!cinder::gl::ScopedFramebuffer::ScopedFramebuffer(const std::shared_ptr<cinder::gl::Fbo> & fbo, unsigned int target) Line 173	C++

ending in an access violation.

Anyone else have any experience with this?