[vtkusers] Problems with vtkFlRenderWindowInteractor

Robert Belleman robbel at science.uva.nl
Thu Oct 31 07:16:54 EST 2002


On Thu, Oct 31, 2002 at 06:27:24AM -0500, Jeff Lee wrote:
> Robert Belleman wrote:
> >On Wed, Oct 30, 2002 at 04:14:41PM -0500, Joshua A Foster wrote:
> >>1) We are all running NVidia drivers version 1.0-3123 now, and we still get 
> >>"XRequest.144: BadAccess (attempt to access private resource denied)" 
> >>frequently and "Xlib: unexpected async reply (sequence 0xa9)" on rare 
> >>occasions.
> >
> >You will get the latter message when multiple threads access the same
> >X server.  To solve this, call XInitThreads() at the start of your
> >program.
> >
> >Actually; this issue has come up a number of times now, so it warrants
> >a permanent solution.  It would be a good idea to add this call to
> >vtkXOpenGLRenderWindow.cxx.
> >
> IMHO, this would not be a good place to make this call, as it must be 
> called before any other X calls,

You're right; XInitThreads should be called before any other X call. 

> and there are very few situations I can 
> think of where a vtkXOpenGLRenderWindow is the first X-related object 
> created in an app.

Well... Most C++ examples in the Vtk source tree will probably call
XOpenDisplay() in vtkXOpenGLRenderWindow as their first X call, but
granted; non of these are multi-threaded and so they will not suffer
from this problem.

Anyway; now that I've given it a little more thought -
vtkXOpenGLRenderWindow is, indeed, probably not the right place.

> Another solution is to make the call from your own program,

Agreed; we should add a note about this in the FAQ.

But I think there is a little bit more we could do;

I noticed that some of the Vtk interfaces to X windows GUI toolkits
(i.e. Qt, Fltk, etc) use a multithreaded approach to split Vtk's and
the toolkit's event handling loop - these interfaces should call
XInitThreads at initialization.

> or better-yet to make sure that you only modify the render 
> window from a single thread.

You mean; make sure that you only access *the X server* from one
thread. The renderer is not the real issue.  However, there are
advantages to multithreading an application *and* have the different
threads access the same server.  One such example is a Vtk application
in conjunction with an X GUI.

-- Rob

-- 
[] Robert Belleman         X  Section Computational Science            []
[] robbel at science.uva.nl  |X| University of Amsterdam, the Netherlands []
[] tel: (+31) 20 525 7510  X  http://www.science.uva.nl/~robbel/       []



More information about the vtkusers mailing list