Hi,

I'm porting a fully functional QGLWidget based application to use QOpenGLWidget instead and I'm hitting some resource tidying up issues since there appear to differences in the way that the two close down.

Looking at the documentation, the way to guarantee that you get a notification when the context is still valid is to hook into the QOpenGLContext::aboutToBeDestroyed signal.

So in my derived class (COpenGlWnd) I have this:

Qt Code:
  1. void COpenGlWnd::initializeGL()
  2. {
  3. connect(context(), &QOpenGLContext::aboutToBeDestroyed,
  4. this, &COpenGlWnd::contextAboutToBeDestroyed);
  5.  
  6. // Other intialisation stuff
  7. Initialise();
  8. }
To copy to clipboard, switch view to plain text mode 

However the slot (contextAboutToBeDestroyed) is never called when I exit the application so I can't clean up properly and get a lot of OpenGl warnings as I shut down and try to delete resources (display lists, textures etc) because the context is no longer valid. These could of course be ignored since I am shutting down anyway, but I don't want to get in the habit of ignoring warnings that might indicate other faults.

I am quite familiar with Qt as well as signals and slots and everything seems to be in order otherwise.

Can anyone tell me what I am doing wrong or whether this signal simply isn't issued during shutdown, in which case what am I supposed to do?

Thanks,

Steve.