OpenGL context destroyed when exiting kiosk mode

I want to exit kiosk mode when returning from fullscreen.
So I’ve called setKioskModeComponent with a nullptr on my escapeKey callback as written in the documentation. But this function destroys the opengl context when setting up a new native titlebar. That’s really annoying as I want the OpenGL part running when getting back to normal screen. Have I missed something? Is there a solution to prevent the opengl context from closing?