Move __try into lambda.
This commit is contained in:
parent
b913e9be1e
commit
525d0da126
|
@ -275,14 +275,16 @@ bool CACHED_CONTAINER::reallocate( unsigned int aSize )
|
||||||
|
|
||||||
void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
|
||||||
__try
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// Defragmentation
|
// Defragmentation
|
||||||
ITEMS::iterator it, it_end;
|
ITEMS::iterator it, it_end;
|
||||||
int newOffset = 0;
|
int newOffset = 0;
|
||||||
|
|
||||||
|
[&]()
|
||||||
|
{
|
||||||
|
#ifdef __WIN32__
|
||||||
|
__try
|
||||||
|
#endif
|
||||||
|
{
|
||||||
for( VERTEX_ITEM* item : m_items )
|
for( VERTEX_ITEM* item : m_items )
|
||||||
{
|
{
|
||||||
int itemOffset = item->GetOffset();
|
int itemOffset = item->GetOffset();
|
||||||
|
@ -306,17 +308,19 @@ void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||||
m_item->setOffset( newOffset );
|
m_item->setOffset( newOffset );
|
||||||
m_chunkOffset = newOffset;
|
m_chunkOffset = newOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_maxIndex = usedSpace();
|
|
||||||
}
|
}
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
__except( GetExceptionCode() == STATUS_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER
|
__except( GetExceptionCode() == STATUS_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER
|
||||||
: EXCEPTION_CONTINUE_SEARCH )
|
: EXCEPTION_CONTINUE_SEARCH )
|
||||||
{
|
{
|
||||||
throw std::runtime_error( "Access violation in defragment. This is usually an indicator of "
|
throw std::runtime_error(
|
||||||
|
"Access violation in defragment. This is usually an indicator of "
|
||||||
"system or GPU memory running low." );
|
"system or GPU memory running low." );
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
}();
|
||||||
|
|
||||||
|
m_maxIndex = usedSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue