Qt 应用程序关闭时出错:QGLContext::makeCurrent:无法将无效的上下文设为当前上下文

Qt 应用程序关闭时出错:QGLContext::makeCurrent:无法将无效的上下文设为当前上下文,qt,pyqt,vtk,Qt,Pyqt,Vtk,我的应用程序使用PyQt并实例化一个QVTKOpenGLWidget。当我的应用程序关闭时,我在stderr上看到此错误: QGLContext::makeCurrent: Cannot make invalid context current 它看起来是无害的,但对我的用户来说似乎很重要。我如何防止它?我不确定错误的含义或原因,但消除错误的最简单方法是确保在关闭应用程序的其余部分之前销毁了QVTKOpenGLWidget: self.qvtk=QVTKOpenGLWidget() def d

我的应用程序使用PyQt并实例化一个
QVTKOpenGLWidget
。当我的应用程序关闭时,我在
stderr
上看到此错误:

QGLContext::makeCurrent: Cannot make invalid context current

它看起来是无害的,但对我的用户来说似乎很重要。我如何防止它?

我不确定错误的含义或原因,但消除错误的最简单方法是确保在关闭应用程序的其余部分之前销毁了
QVTKOpenGLWidget

self.qvtk=QVTKOpenGLWidget()
def delete_gl_widget():
self.qvtk.setParent(无)
del self.qvtk
QApplication.instance().aboutToQuit.connect(删除\u gl\u小部件)