Framebuffer doesnt get unbound, glitches only on Nvidia

I was working on bringing back missing functionality that was missing when we moved to QOpenGLWidget and run into this issue.
The code works in all Intel,AMD and software mesa drivers, but just to make sure there is no weird interaction in Qt I also checked by replaying apitrace.

Apitrace: https://drive.google.com/file/d/1VIEfuD1qccvc02cgQXzqorVsRR1qQ3f4/view?usp=sharing
Pull request: https://github.com/openscad/openscad/pull/2466
Right now only blocker is the Nvidia glitches

29376: message: major api error 1282: GL_INVALID_OPERATION error generated. Object is owned by another context and may not be bound here.
29376 @0 glBindFramebuffer(target = GL_FRAMEBUFFER, framebuffer = 2)
29376: warning: glGetError(glBindFramebuffer) = GL_INVALID_OPERATION