[vtkusers] GLXBadDrawable on application exit

Clinton Stimpson clinton at elemtech.com
Mon Jul 2 16:07:39 EDT 2012


I don't see a way to have Qt tell you when its going to destroy the window.  
Perhaps you can add a 
def closeEvent(self, ev):
  self._RenderWindow.Finalize()

That might be harmless even if one wants to show the window again.

Clint

On Wednesday, June 27, 2012 01:45:33 PM Félix C. Morency wrote:
> Clinton,
> 
> Thank you for your answer. Destructors in Python are a bit tricky and
> I'm not too familiar with it. If I understand correctly, the __del__()
> method will be called if the reference count to the current object is
> zero. However, it seems that the reference count of the
> QVTKRenderWindowInteractor will never be zero because of self
> reference given by the lines:
> 
>     self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
>     self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
>     self._Iren.GetRenderWindow().AddObserver('CursorChangedEvent',
> self.CursorChangedEvent)
> 
> If I comment those lines anyway, the following destructor is called:
> 
>    def __del__(self):
>        self._RenderWindow.Finalize()
> 
> However, I still have the GLXBadDrawable errors when creating multiple
> embedded VTK window.
> 
> Also, if I had
> 
>     vtk_interactor1.Initialize()
>     vtk_interactor2.Initialize()
> 
> after the lines
> 
>     vtk_interactor1 = QVTKRenderWindowInteractor(parent=qframe1)
>     vtk_interactor2 = QVTKRenderWindowInteractor(parent=qframe2)
> 
> of the code snippet of my previous message, the application segfault.
> However, if I start that same application with the '-sync' parameter
> you mentioned in the other email thread, it works. You can find
> another example in [1] that works with and without the '-sync'
> parameter. This time, the two Initialize() calls don't crash the
> application. The main difference is that the windows are not embedded
> in a MdiArea. However, I still have GLXBadDrawable, even with the
> added destructor in QVTKRenderWindow.
> 
> [1]: https://gist.github.com/3005627
> 
> Regards,
> -F
> 
> On Fri, Jun 22, 2012 at 6:42 PM, Clinton Stimpson <clinton at elemtech.com> 
wrote:
> > QVTKRenderWindowInteractor needs a destructor that calls Finalize() on
> > the vtkRenderWindow.
> > Otherwise, vtkXOpenGLRenderWindow::Finalize() will be called after the
> > QWidget is gone, leading to X errors with an invalid Window.
> > 
> > Clint
> > 
> > On Thursday, June 21, 2012 02:11:36 PM Félix C. Morency wrote:
> >> Hi,
> >> 
> >> I posted this issue in another thread on the developers mailing list
> >> but felt I should post it here. I encounter GLXBadDrawable errors when
> >> I exit an application rendering multiple QVTKRenderWindowInteractor in
> >> a QMdiArea. The GLXBadDrawable looks like
> >> 
> >> X Error of failed request:  GLXBadDrawable
> >>   Major opcode of failed request:  135 (GLX)
> >>   Minor opcode of failed request:  5 (X_GLXMakeCurrent)
> >>   Serial number of failed request:  95
> >>   Current serial number in output stream:  95
> >> 
> >> You can find in [1] a code snippet that reproduces the issue. It
> >> happens on Linux as well as on Windows. It has been tested with PySide
> >> v1.1.1, PyQt4 v4.9.1 and VTK 5.10.0.
> >> 
> >> Does anyone have a clue why this is happening?
> >> 
> >> [1]: https://gist.github.com/2967336
> >> 
> >> Regards,
> >> --
> >> Félix C. Morency, M.Sc.
> >> Plateforme d’analyse et de visualisation d’images
> >> Centre Hospitalier Universitaire de Sherbrooke
> >> Centre de recherche clinique Étienne-Le Bel
> >> Local Z5-3031 | 819.346.1110 ext 16634
> >> _______________________________________________
> >> Powered by www.kitware.com
> >> 
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >> 
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >> 
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> > 
> > --
> > Clinton Stimpson
> > Elemental Technologies, Inc
> > Computational Simulation Software, LLC
> > www.csimsoft.com
-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com



More information about the vtkusers mailing list