Catch access violation in defragment due to OpenGL drivers on Windows.
This commit is contained in:
parent
d1f6ba77e8
commit
74a242c662
|
@ -40,6 +40,10 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#ifdef __WIN32__
|
||||||
|
#include <excpt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef KICAD_GAL_PROFILE
|
#ifdef KICAD_GAL_PROFILE
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <profile.h>
|
#include <profile.h>
|
||||||
|
@ -275,6 +279,10 @@ void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||||
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();
|
||||||
|
@ -298,6 +306,15 @@ void CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
||||||
m_item->setOffset( newOffset );
|
m_item->setOffset( newOffset );
|
||||||
m_chunkOffset = newOffset;
|
m_chunkOffset = newOffset;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#ifdef __WIN32__
|
||||||
|
__except( GetExceptionCode() == STATUS_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER
|
||||||
|
: EXCEPTION_CONTINUE_SEARCH )
|
||||||
|
{
|
||||||
|
throw std::runtime_error( "Access violation in defragment. This is usually an indicator of "
|
||||||
|
"system or GPU memory running low." );
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
m_maxIndex = usedSpace();
|
m_maxIndex = usedSpace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue