From 09b40cf1b176a0791669b9514d1bd1e3e834a84d Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 12 Mar 2009 03:39:56 +0000 Subject: [PATCH] ide: fix a memory leak I made in TSourceEditor.OnGutterClick git-svn-id: trunk@18964 - --- ide/sourceeditor.pp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index c6aa71a968..8b6bf67f42 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -2088,21 +2088,26 @@ var begin // create or delete breakpoint // find breakpoint mark at line - SourceEditorMarks.GetMarksForLine(FEditor, Line, Marks, MarkCount); - BreakFound := False; - ExecutionFound := False; - for i := 0 to MarkCount - 1 do - begin - if not Marks[i].Visible then - Continue; - if Marks[i].IsBreakPoint then + Marks := nil; + try + SourceEditorMarks.GetMarksForLine(FEditor, Line, Marks, MarkCount); + BreakFound := False; + ExecutionFound := False; + for i := 0 to MarkCount - 1 do begin - BreakFound := True; - DebugBoss.DoDeleteBreakPointAtMark(Marks[i]) - end - else - if Marks[i] = FExecutionMark then - ExecutionFound := True; + if not Marks[i].Visible then + Continue; + if Marks[i].IsBreakPoint then + begin + BreakFound := True; + DebugBoss.DoDeleteBreakPointAtMark(Marks[i]) + end + else + if Marks[i] = FExecutionMark then + ExecutionFound := True; + end; + finally + FreeMem(Marks); end; if not BreakFound then