[vtkusers] Not closing connection on X
Joey Mukherjee
joey at phobos.space.swri.edu
Wed Aug 29 12:16:23 EDT 2001
Hello!
I have found a strange bug with VTK and X. Here is an excerpt from
vtkXRenderWindowInteractor.cxx:
this->DisplayId = ren->GetDisplayId();
if (!this->DisplayId)
{
vtkDebugMacro("opening display");
this->DisplayId =
XtOpenDisplay(this->App,NULL,"VTK","vtk",NULL,0,&argc,NULL);
vtkDebugMacro("opened display");
}
else
{
// if there is no parent widget
if (!this->top)
{
XtDisplayInitialize(this->App,this->DisplayId,
"VTK","vtk",NULL,0,&argc,NULL);
}
}
// get the info we need from the RenderingWindow
ren->SetDisplayId(this->DisplayId);
The first line is ren->GetDisplayId () which will create a connection to the
display with XOpenDisplay. This will set an internal variable "OwnDisplay" to 1
since it created it.
The last line sets the DisplayId to the newly created DisplayId which will cause
it to reset the OwnDisplay to 0 so the connection never gets closed. This will
cause an error after around 38 draws since it will run out of connections.
Any X gurus know how to solve this one? I worked on it for a while and it isn't
as simple as closing the connection since forcing it to close seems to cause
other problems.
I have my own GUI which I use and then I let VTK create its own window for all
its rendering. I am not embedding the rendering window which is why I think
this is causing a problem for me. If I were to embed in my own GUI, I think
everything would be fine, but what I'm doing is "legal", isn't it?
Thanks for any advice!
Joey
+--------------------------------------------------------------------------+
+ +
+ Joey Mukherjee "The price of freedom is eternal +
+ joey at swri.org vigilance, or $12.50 as seen on +
+ E-Bay... +
+ +
+--------------------------------------------------------------------------+
More information about the vtkusers
mailing list