Re: Non initialized array
Paul Miller <[email protected]> Tue, 22 Nov 2016 10:17:27 -0600
| Newsgroups | gmane.comp.video.openexr.devel |
|---|---|
| Organization | FXTECH |
| Message-ID | <[email protected]> |
On 11/22/2016 10:11 AM, Michel Lerenard wrote:
> On 11/22/2016 04:55 PM, Paul Miller wrote:
>> On 11/22/2016 8:28 AM, Michel Lerenard wrote:
>>> The lineSampleCount array is never reset. The code calls
>>> _data->lineSampleCount.resizeErase(_data->maxY - _data->minY + 1);
>>>
>>> in initialize(), then in the execute function of the buffer task, we
>>> increment the values of the cells, although they have never been set to
>>> zero !
>>
>> Doesn't "resizeErase" also set to zero?
>>
> Unfortunately not:
>
> From ImfArray.h:
>
> template <class T>
> inline void
> Array<T>::resizeErase (long size)
> {
> T *tmp = new T[size];
> delete [] _data;
> _size = size;
> _data = tmp;
> }
Yikes! The function description has this unfortunate comment (in
addition to the already-unfortunate function name):
//------------------------------------------------------
// Resize and clear the array (the contents of the array
// are not preserved across the resize operation).
//