Crash fix.
This commit is contained in:
parent
37f1ddaed2
commit
98526d38d3
@ -547,7 +547,8 @@ namespace PolyVox
|
|||||||
// The block was found so we can use it.
|
// The block was found so we can use it.
|
||||||
pUncompressedBlock = itUncompressedBlock->second;
|
pUncompressedBlock = itUncompressedBlock->second;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!pUncompressedBlock)
|
||||||
{
|
{
|
||||||
// There's some (slim) chance that it exists in the list of all blocks, because a sampler may be holding on to it.
|
// There's some (slim) chance that it exists in the list of all blocks, because a sampler may be holding on to it.
|
||||||
typename WeakPtrBlockMap::iterator itWeakUncompressedBlock = m_pAllBlocks.find(v3dBlockPos);
|
typename WeakPtrBlockMap::iterator itWeakUncompressedBlock = m_pAllBlocks.find(v3dBlockPos);
|
||||||
@ -564,7 +565,9 @@ namespace PolyVox
|
|||||||
m_pAllBlocks.erase(itWeakUncompressedBlock);
|
m_pAllBlocks.erase(itWeakUncompressedBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if (!pUncompressedBlock)
|
||||||
{
|
{
|
||||||
// The block was not found so we will create a new one.
|
// The block was not found so we will create a new one.
|
||||||
pUncompressedBlock = std::make_shared< UncompressedBlock<VoxelType> >(v3dBlockPos, m_uBlockSideLength, m_pPager);
|
pUncompressedBlock = std::make_shared< UncompressedBlock<VoxelType> >(v3dBlockPos, m_uBlockSideLength, m_pPager);
|
||||||
@ -590,7 +593,6 @@ namespace PolyVox
|
|||||||
m_pAllBlocks.insert(std::make_pair(v3dBlockPos, pUncompressedBlock));
|
m_pAllBlocks.insert(std::make_pair(v3dBlockPos, pUncompressedBlock));
|
||||||
m_pRecentlyUsedBlocks.insert(std::make_pair(v3dBlockPos, pUncompressedBlock));
|
m_pRecentlyUsedBlocks.insert(std::make_pair(v3dBlockPos, pUncompressedBlock));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pUncompressedBlock->m_uBlockLastAccessed = ++m_uTimestamper;
|
pUncompressedBlock->m_uBlockLastAccessed = ++m_uTimestamper;
|
||||||
m_pLastAccessedBlock = pUncompressedBlock;
|
m_pLastAccessedBlock = pUncompressedBlock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user