Fix some memory leaks.

This commit is contained in:
Jeff Young 2020-04-16 21:57:07 +01:00
parent 66059d6d55
commit cb708aaadb
1 changed files with 10 additions and 18 deletions

View File

@ -984,9 +984,9 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, DRAWSEGMEN
if( evt->IsCancelInteractive() )
{
if( started )
cleanup();
else
if( !started )
{
m_frame->PopTool( aTool );
cancelled = true;
@ -1002,18 +1002,14 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, DRAWSEGMEN
}
else if( evt->IsMoveTool() )
{
if( started )
cleanup();
// leave ourselves on the stack so we come back after the move
cancelled = true;
break;
}
else
{
if( started )
cleanup();
m_frame->PopTool( aTool );
cancelled = true;
break;
@ -1219,9 +1215,9 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, DRAWSEGMENT*& aGraphic, bo
if( evt->IsCancelInteractive() )
{
if( firstPoint )
cleanup();
else
if( !firstPoint )
{
m_frame->PopTool( aTool );
cancelled = true;
@ -1237,18 +1233,14 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, DRAWSEGMENT*& aGraphic, bo
}
else if( evt->IsMoveTool() )
{
if( firstPoint )
cleanup();
// leave ourselves on the stack so we come back after the move
cancelled = true;
break;
}
else
{
if( firstPoint )
cleanup();
m_frame->PopTool( aTool );
cancelled = true;
break;