[vtkusers] Trouble with QVTK and X11 Garbage Collection

Chris Hahn chahn at ucalgary.ca
Wed Apr 5 23:48:53 EDT 2006


Hi

I'm having a little trouble deleting a Qt window which contains a QVTK 
widget. The code that I'm using to display and use this QVTK widget is 
based off of one of the examples online and basically goes like this:

...
     qVTK1->SetRenderWindow(theViewer->GetRenderWindow());
     theViewer->SetupInteractor(qVTK1->GetRenderWindow()->GetInteractor());
     qVTK1->show();
...

Where 'theViewer' is a vtk object of type vtkImageViewer. My destructor 
for this window is as follows:

...
    if(theViewer != NULL)
        theViewer->Delete();
    destroy(); //destroys the Qt window
...

My problem is if I try to delete the window using this destructor I get 
the following error message:

X Error: BadValue (integer parameter out of range for operation) 2
  Extension:    145 (Uknown extension)
  Minor opcode: 9 (Unknown request)
  Resource id:  0x2a0010f
X Error: BadValue (integer parameter out of range for operation) 2
  Extension:    145 (Uknown extension)
  Minor opcode: 9 (Unknown request)
  Resource id:  0x2a00117

And then the program seg faults. Now, if I set the QVTK widget's render 
window to NULL in the destructor, then I can delete the Qt window with 
no problem. However, if I try to create a new window of the same type as 
I just deleted, I get another segmentation fault. This segmentation 
fault occurs right after the call to 
qVTK1->SetRenderWindow(theViewer->GetRenderWindow()) and when I traced 
it using insight, it supposedly happened in 
__driGarbageCollectDrawables, which I believe is related to the X11 
driver for my video card.

So my question is does anyone know if this is a driver issue or am I 
doing something wrong with QVTK?

Thanks,
Chris




More information about the vtkusers mailing list