Permalink
Browse files

Fixed critical threading bug when using a cache per thread.

  • Loading branch information...
1 parent 66d1c27 commit c29fec4673a26924f1bdcdd2e8edec16fb75fe55 Brent Burley committed May 9, 2011
Showing with 2 additions and 11 deletions.
  1. +0 −7 src/ptex/PtexHashMap.h
  2. +2 −4 src/ptex/PtexReader.cpp
View
@@ -113,13 +113,6 @@ class PtexHashMap
return value_type();
}
- /// Pointer reference operator
- value_type* operator->() const {
- static value_type v;
- v = operator*();
- return &v;
- }
-
/// Proper assignment operator
iterator& operator=(const iterator& iter) {
e = iter.e; h = iter.h; b = iter.b; return *this;
View
@@ -169,7 +169,7 @@ PtexReader::~PtexReader()
// the rest must be orphaned since there may still be references outstanding
orphanList(_levels);
for (ReductionMap::iterator i = _reductions.begin(); i != _reductions.end(); i++) {
- FaceData* f = i->second;
+ FaceData* f = (*i).second;
if (f) f->orphan();
}
if (_metadata) {
@@ -751,8 +751,7 @@ void PtexReader::readFaceData(FilePos pos, FaceDataHeader fdh, Res res, int leve
int unpackedSize = _pixelsize * npixels;
PackedFace* pf = new PackedFace((void**)&face, _cache,
res, _pixelsize, unpackedSize);
- bool useMalloc = unpackedSize > AllocaMax;
- void* tmp = useMalloc ? malloc(unpackedSize) : alloca(unpackedSize);
+ void* tmp = alloca(unpackedSize);
readZipBlock(tmp, fdh.blocksize(), unpackedSize);
if (fdh.encoding() == enc_diffzipped)
PtexUtils::decodeDifference(tmp, unpackedSize, _header.datatype);
@@ -763,7 +762,6 @@ void PtexReader::readFaceData(FilePos pos, FaceDataHeader fdh, Res res, int leve
PtexUtils::multalpha(pf->data(), npixels, _header.datatype,
_header.nchannels, _header.alphachan);
newface = pf;
- if (useMalloc) free(tmp);
}
break;
}

0 comments on commit c29fec4

Please sign in to comment.