Free memory in dxf import sooner on bad_alloc
(cherry picked from commit b18e441a88
)
This commit is contained in:
parent
39959844e5
commit
455ec428f2
|
@ -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;
|
||||
|
||||
|
|
|
@ -354,6 +354,11 @@ public:
|
|||
return m_shapes;
|
||||
}
|
||||
|
||||
void ClearShapes()
|
||||
{
|
||||
m_shapes.clear();
|
||||
}
|
||||
|
||||
void PostprocessNestedPolygons();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue