Re: Seg. violation when doing a pfGetCurMtl

New Message Reply Date view Thread view Subject view Author view

Allan Schaffer (aschaffe)
Thu, 3 Nov 1994 17:21:30 -0800


On Oct 2, 12:55pm, John A. Collier wrote:
> I am getting a segmentation violation whenever I try to get the
> current material type. Here is the code excerpt:
>
> void
> updateMyShmem(void)
> { int index;
> extern geoset_list[100];
> extern geoset_index;
> extern gstate_list[100];
> pfGeoState *gstate;
> pfGeoSet *gset;
> pfMaterial *mtl;
> long prim_type;
> long *answer;
> void *arena;
>
> arena=pfGetSharedArena();
> gset = (pfGeoSet *)geoset_list[0];
> gstate= (pfGeoState *)gstate_list[0];
> pfLoadGState(gstate);
> mtl=pfNewMtl(NULL);
> mtl=pfGetCurMtl(PFMTL_FRONT); <- Seg. Violation here
> }

Generally speaking this code is OK.

I suspect that this is a multiprocessing issue, probably caused by
the 'gstate' data pointed to by gstate_list[0] not being visible by
this process.

As a quick check to verify this is the problem, put your program in
single-process mode via pfMultiprocess(PFMP_APPCULLDRAW).

pfGetCurMtl() just dereferences the "current geostate" (which you had
just loaded with pfLoadGState) so make sure that 'gstate' is valid.
In particular, make certain that the gstate's in gstate_list are
being allocated in shared memory.

Allan

-- 
Allan Schaffer
Silicon Graphics
aschaffe++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:38 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.