Kiosk Mode With OpenGL on Windows (Fixed)

I am having an issue on windows 7 with Kiosk Mode using OpenGL (it works great on OS X).  When I go to full screen, 


it is just blank or hangs up when I try to switch back.  I can reproduce an issue (different) using the demo.  If you go to full screen mode and then try to go back it keeps the full screen up,  and then shows the resized window on top of it.  However,  in the case with the demo, I have to switch back and forth a bunch of times before it hangs.  If I ctrl-alt-del and then select the icon again,  the demo will show up and respond again. 

I noticed that on windows when going to kiosk mode that the openGLContextClosing gets called, but this does not get called on OS X.  How do you re-initialize the context in newOpenGLContextCreated.  I am using (in my renderOpenGL):

OpenGLFrameBuffer* buffer =  OpenGLImageType::getFrameBufferFrom(*img);

buffer->writePixels((PixelARGB *)dat.frame->data[0], img_rect);

with a new img being created if the context switched.  I get an unknown error in OpenGL when I call buffer->writePixels.


Any ideas (assuming these two issues are related)? 


It turns out that even though I was creating a new img (which is  a scoped pointer), I had to set it to nullptr as well.