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?

> 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 ?

SimpleSHLVariableChunk::addUniformVariable() creates the 
ShaderProgramVariables objects if the pointer stored in the field is NULL.
It looks like creation of that object fails for some reason, but offhand 
I don't have a good idea why that may be the case.

        Cheers,
                Carsten


------------------------------------------------------------------------------
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