Free memory in dxf import sooner on bad_alloc
This commit is contained in:
parent
9f8c0a8185
commit
b18e441a88
|
@ -124,6 +124,12 @@ bool DXF_IMPORT_PLUGIN::Load( const wxString& aFileName )
|
|||
}
|
||||
catch( const std::bad_alloc& )
|
||||
{
|
||||
m_layers.clear();
|
||||
m_blocks.clear();
|
||||
m_styles.clear();
|
||||
|
||||
m_internalImporter.ClearShapes();
|
||||
|
||||
reportMsg( _( "Memory was exhausted trying to load the DXF, it may be too large." ) );
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -189,6 +189,14 @@ public:
|
|||
return m_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties out the imported shapes list
|
||||
*/
|
||||
void ClearItems()
|
||||
{
|
||||
m_items.clear();
|
||||
}
|
||||
|
||||
///< Default line thickness (in mm)
|
||||
static constexpr unsigned int DEFAULT_LINE_WIDTH_DFX = 1;
|
||||
|
||||
|
|
|
@ -355,6 +355,11 @@ public:
|
|||
return m_shapes;
|
||||
}
|
||||
|
||||
void ClearShapes()
|
||||
{
|
||||
m_shapes.clear();
|
||||
}
|
||||
|
||||
void PostprocessNestedPolygons();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue