Hi,

On Tue, 2009-08-18 at 20:59 +0200, Marcus Lindblom wrote:
> 
> Carsten Neumann wrote:
> >     Hello Marcus,
> > 
> > Marcus Lindblom wrote:
> >> I just compiled r2042 and something has broken, as I got a crash when 
> >> trying to call addUniformVariable() on a SimpleSHLVariableChunk. This 
> >> has worked before (r1874).
> >>
> >> I can't really find anything wrong with my code (which worked before), 
> >> but you never know. Here it goes:
> >>
> >> OSGDicomVolume::OSGDicomVolume() :
> >>      m_shader_mode(SM_FLUORO_SIM),
> >>      m_16bit_size_threshold(450e6),
> >>      m_material(ChunkMaterial::create()),
> >>      m_parameters(OSG::SimpleSHLVariableChunk::create())
> >> {
> >>      m_parameters->addUniformVariable("volume", 0);  <---  crash
> >>
> >> m_parameters is a SimpleSHLVariableChunkRefPtr.
> > 
> > I assume OSGDicomVolume is not an OpenSG FieldContainer and instances of 
> > it are only created after osgInit on threads OpenSG knows about?
> 
> Yup.
> 
> >> Here's how the callstack looks:
> >>
> >> OSGSystemD.dll!OSG::ShaderProgramVariables::addUniformVariable(const 
> >> char * name=0x5019718c, int value=0, 
> >> OSG::MField<int,0,std::allocator<int> > * pVarLoc=0x047c34fc, 
> >> OSG::MField<int,0,std::allocator<int> > * pProcVarLoc=0x00000000)  Line 
> >> 361 + 0x13 bytes   C++
> >>
> >> OrzDicomD.dll!OSG::SimpleSHLVariableChunk::addUniformVariable<int>(const 
> >> char * name=0x5019718c, const int & value=0)  Line 95      C++
> >>
> >> OrzDicomD.dll!orz::OSGDicomVolume::OSGDicomVolume()  Line 29       C++
> >>
> >> The culprit for the crash is the _sfVariables member in 
> >> SimpleSHLVariableChunk which is 0xcdcdcdcd, i.e. newly allocated memory 
> >> that hasn't been written to yet. 
> >> (http://www.nobugs.org/developer/win32/debug_crt_heap.html)
> > 
> > hm, _sfVariables is of type SFUnrecChildShaderProgramVariablesPtr, i.e. 
> > it is a SField that stores a pointer to a ShaderProgramVariables object. 
> > Is the value stored in the field 0xcdcdcdcd or the pointed-to memory, i.e.
> > 
> > is _sfVariables.getValue() == 0xcdcdcdcd
> > or is *reinterpret_cast<UInt32>(_sfVariables.getValue()) == 0xcdcdcdcd ?
> 
> The first, i.e. the value there. In the crashing function, on top, the 
> this ptr is 0xcdcdcdcd.

but wouldn't that mean the already object behind m_parameters is not
valid. E.g. the initial
m_parameters(OSG::SimpleSHLVariableChunk::create()) 
fails somehow.  Though I could not reproduce it with the current head
2043, at least with simple tests.

kind regards,
  gerrit




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to