Paul Melis wrote:
Jean-Sébastien Guay wrote:
Hello all,
In osg/Uniform.cpp, there is this code:
void Uniform::allocateDataArray()
{
// if one array is already allocated, the job is done.
if( _floatArray.valid() != _intArray.valid() ) return;
// ...
}
I don't think the code does what the comment says it should do... If
both are not valid, the method will return, but no array will have
been allocated.
Hi J-S,
Jean-Sébastien Guay wrote:
> Hello all,
>
> In osg/Uniform.cpp, there is this code:
>
> void Uniform::allocateDataArray()
> {
> // if one array is already allocated, the job is done.
> if( _floatArray.valid() != _intArray.valid() ) return;
>
> // ...
> }
>
> I don't think the code does what the comment says it should do... If
> both are not valid, the method will return, but no array will have
> been allocated.
Hmm, if both are not valid the expression tested would be (false !=
false), which evaluates to false. The method does not return in that
case. It only returns if one of the arrays has been allocated and the
other one hasn't.
Paul
> I currently have a crash when setting a bool uniform, because the
_intArray is a null pointer, and it seems like this code could be the
cause.
>
> I would replace that with:
>
> if ( _floatArray.valid() || _intArray.valid() ) return;
>
> Any objections? :-)
>
> J-S
I currently have a crash when setting a bool uniform, because the
_intArray is a null pointer, and it seems like this code could be the
cause.
Could it be that the float array is allocated in this case, while it
should have been the int array?
Paul
I would replace that with:
if ( _floatArray.valid() || _intArray.valid() ) return;
Any objections? :-)
J-S
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org