Never mind, I figured it out. I had to write a slot that gets connected to QOpenGLContext::aboutToBeDestroyed(). This did the trick.
Kyle On Tue, 2019-01-08 at 11:52 -0500, Kyle Edwards wrote: > Hello all, > > My application has a QOpenGLWidget inside a QDockWidget. I initialize > my shaders, textures, etc. in the initializeGL() call as required. > However, when I undock the QDockWidget from the main window, > initializeGL() is called again. At this point, there's no way to > safely > destroy the old resources because the context has already been > destroyed, so calling the destructor of the old QOpenGLTexture > results > in a segfault. > > I've tried enabling AA_ShareOpenGLContexts before creating my > application, but initializeGL() still gets called again, even though > the code indicates that it shouldn't be (see > qtbase/src/widgets/kernel/qopenglwidget.cpp:1436-1443 - I'm using Qt > 5.12.0.) > > What's going on here? Shouldn't initializeGL() be skipped since > AA_ShareOpenGLContexts is enabled? If this is intended behavior, then > what's the best way to deal with this issue? > > Kyle _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest