[vtkusers] Repeatable core using nested vtkPropAssembly under VTK 3.2.0 and X

Eric F. Sorton eric at cctcorp.com
Thu Apr 25 12:47:45 EDT 2002


I have compiled additional information on the problem which is noted below.

On Wed, Apr 24, 2002 at 12:55:56PM -0400, Eric F. Sorton wrote:
> I am attempting to create a hierarchy of objects.  I am using the
> vtkPropAssembly class as a container.   As discussed, in the documentation, it
> should be possible to create a hierarchy of vktPropAssembly.  When I create
> nested vtkPropAssembly's, my application dumps a core.

I changed from a vtkPropAssembly to a vtkAssembly and all worked well.
However, I would like my assembly to consist of both vtkProp items and
vtkProp3D objects so using vtkAssembly is not a viable option (vtkAssembly only
works with vtkProp3D objects).

> I used the graphics/examplesCxx/Cone4.cxx as a base and added two
> vtkPropAssembly classes.  See attached code.  When I execute this code, I get a
> core dump.  Pulling up the debugger, I get the following stack trace:
> 
> #0  0x40328add in vtkProp3D::PokeMatrix () from /usr/lib/libVTKGraphics.so.3.2
> #1  0x407ea3d4 in vtkPropAssembly::RenderOpaqueGeometry () from /usr/lib/libVTKCommon.so.3.2
> #2  0x40277c81 in vtkRenderer::UpdateGeometry () from /usr/lib/libVTKGraphics.so.3.2
> #3  0x40319049 in vtkOpenGLRenderer::DeviceRender () from /usr/lib/libVTKGraphics.so.3.2
> #4  0x40276f0c in vtkRenderer::Render () from /usr/lib/libVTKGraphics.so.3.2
> #5  0x4027bc95 in vtkRendererCollection::Render () from /usr/lib/libVTKGraphics.so.3.2
> #6  0x402739e5 in vtkRenderWindow::DoStereoRender () from /usr/lib/libVTKGraphics.so.3.2
> #7  0x40273992 in vtkRenderWindow::DoFDRender () from /usr/lib/libVTKGraphics.so.3.2
> #8  0x402735b6 in vtkRenderWindow::DoAARender () from /usr/lib/libVTKGraphics.so.3.2
> #9  0x40272e2b in vtkRenderWindow::Render () from /usr/lib/libVTKGraphics.so.3.2
> #10 0x4032f771 in vtkXRenderWindow::Render () from /usr/lib/libVTKGraphics.so.3.2
> #11 0x0804b24a in main (argc=1, argv=0xbffff9a4) at Cone4.cxx:49
> #12 0x40ab917f in __libc_start_main () from /lib/libc.so.6

I rebuilt with debug when I build vtk 4.0.  The top of the stack now provides
the following information:

#0  0x40688375 in vtkProp3D::PokeMatrix (this=0x8059658, matrix=0x0) at /var/cct/devel/eric/vtk-4.0/Rendering/vtkProp3D.cxx:519

The crash occurs in vtkProp3D::PokeMatrix() on line 519.  The pointer
CachedProp3D is NULL (this was verified with the debugger). 

The problem appears to be in the way assemblies interact with PokeMatrix().  A
review of the code shows that PokeMatrix() is always called in pairs, the
first call sets the matrix while the second call clears it.  Based upon this
design, the first time PokeMatrix() is called matrix should never be NULL.

I added a debug line to the beginning of PokeMatrix().  In the case of nested
assemblies, the FIRST time PokeMatrix() is called, the matrix argument is NULL.
This is obviously incorrect based upon the design described above.

> I am doing something wrong?  Is this a bug in 3.2.0?  Is it fixed in 4.0?  Any
> information would be appreciated.

As I stated in a previous message, the problem occurs in both 3.2.0 and 4.0.

I feel the problem is fairly well isolated, I just need someone with a better
understanding of the overall design to suggest the correct fix.  I was able to
devise the following possibilities, but I am unsure if either is the "correct"
fix:

	o) Eliminate the PokeMatrix() calls from vtkPropAssembly.  I tested
	   this and it works.  Based upon the documentation, vtkPropAssembly is
	   not supposed to allow transforms of its items, therefore, the
	   PokeMatrix() call may not be valid.  I implemented this and it did
	   fix the problem.
	o) Added logic to PokeMatrix() to do nothing when both the matrix input
	   argument and CachedProp3D are NULL.  This would probably work.  This
	   has the feel of fixing the symptom but not the true problem.

Eric

-- 
+--=--=- Eric F. Sorton <eric at cctcorp.com> =--=--=--=--=--=--=--=--=--=-+ 
| Command and Control Technologies Corporation (http://www.cctcorp.com) |
|            Phone: (321) 264-1193   Fax: (321) 383-5096                |
+--=--=--=--=--=--=--=--=--=--=--=-+-=--=--=--=--=--=--=--=--=--=--=--=-+ 



More information about the vtkusers mailing list