mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 16:39:15 +02:00
ToDoList: Prevent a memory leak.
This commit is contained in:
parent
db50e54f97
commit
e2207e76a9
@ -87,7 +87,7 @@ procedure CreateIDEToDoWindow(Sender: TObject; aFormName: string;
|
|||||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||||
// ToDo Dialog
|
// ToDo Dialog
|
||||||
function ExecuteTodoDialog(const aCaption: string; var aTodoItem: TTodoItem): TModalResult;
|
function ExecuteTodoDialog(const aCaption: string; var aTodoItem: TTodoItem): TModalResult;
|
||||||
procedure InsertToDoForActiveSE(aSrcEdit: TSourceEditorInterface);
|
procedure InsertToDo(aSrcEdit: TSourceEditorInterface);
|
||||||
procedure EditToDo(aTodoItem: TTodoItem; aSrcEdit: TSourceEditorInterface);
|
procedure EditToDo(aTodoItem: TTodoItem; aSrcEdit: TSourceEditorInterface);
|
||||||
procedure InsertOrEditToDo(Sender: TObject);
|
procedure InsertOrEditToDo(Sender: TObject);
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ begin
|
|||||||
aTodoDialog.Free;
|
aTodoDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InsertToDoForActiveSE(aSrcEdit: TSourceEditorInterface);
|
procedure InsertToDo(aSrcEdit: TSourceEditorInterface);
|
||||||
var
|
var
|
||||||
TodoItem: TTodoItem;
|
TodoItem: TTodoItem;
|
||||||
begin
|
begin
|
||||||
@ -244,8 +244,6 @@ begin
|
|||||||
if ExecuteTodoDialog(lisTDDEditToDo, aTodoItem) <> mrOK then exit;
|
if ExecuteTodoDialog(lisTDDEditToDo, aTodoItem) <> mrOK then exit;
|
||||||
aSrcEdit.SelectText(aTodoItem.StartPos, aTodoItem.EndPos);
|
aSrcEdit.SelectText(aTodoItem.StartPos, aTodoItem.EndPos);
|
||||||
aSrcEdit.Selection := aTodoItem.AsComment;
|
aSrcEdit.Selection := aTodoItem.AsComment;
|
||||||
if aTodoItem.Temporary then
|
|
||||||
aTodoItem.Free;
|
|
||||||
if Assigned(IDETodoWindow) then
|
if Assigned(IDETodoWindow) then
|
||||||
IDETodoWindow.UpdateTodos; { TODO -oJuha : Retain selection in the list. }
|
IDETodoWindow.UpdateTodos; { TODO -oJuha : Retain selection in the list. }
|
||||||
end;
|
end;
|
||||||
@ -256,10 +254,13 @@ var
|
|||||||
begin
|
begin
|
||||||
SrcEdit := SourceEditorManagerIntf.ActiveEditor;
|
SrcEdit := SourceEditorManagerIntf.ActiveEditor;
|
||||||
if (SrcEdit=nil) or SrcEdit.ReadOnly then exit;
|
if (SrcEdit=nil) or SrcEdit.ReadOnly then exit;
|
||||||
if Assigned(TodoItemToEdit) then
|
if Assigned(TodoItemToEdit) then begin
|
||||||
EditToDo(TodoItemToEdit, SrcEdit)
|
EditToDo(TodoItemToEdit, SrcEdit);
|
||||||
|
if TodoItemToEdit.Temporary then
|
||||||
|
FreeAndNil(TodoItemToEdit);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
InsertToDoForActiveSE(SrcEdit)
|
InsertToDo(SrcEdit)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TTodoDialog }
|
{ TTodoDialog }
|
||||||
|
@ -502,7 +502,8 @@ begin
|
|||||||
Value:=GetCaptionValue(ValueMenuItem.Caption,fCaptionPatternMacroValue);
|
Value:=GetCaptionValue(ValueMenuItem.Caption,fCaptionPatternMacroValue);
|
||||||
Value:=DisplayNameToDirName(Value);
|
Value:=DisplayNameToDirName(Value);
|
||||||
CreateNewOption(BuildMatrixOptionTypeCaption(bmotIDEMacro),'LCLWidgetType:='+Value);
|
CreateNewOption(BuildMatrixOptionTypeCaption(bmotIDEMacro),'LCLWidgetType:='+Value);
|
||||||
// Update LCLWidgetType to Config and Target page. ToDo: update also when deleting or changing.
|
// Update LCLWidgetType to Config and Target page.
|
||||||
|
// ToDo: update also when deleting or changing.
|
||||||
TargetFrame := TCompilerConfigTargetFrame(FDialog.FindEditor(TCompilerConfigTargetFrame));
|
TargetFrame := TCompilerConfigTargetFrame(FDialog.FindEditor(TCompilerConfigTargetFrame));
|
||||||
Assert(Assigned(TargetFrame));
|
Assert(Assigned(TargetFrame));
|
||||||
TargetFrame.UpdateWidgetSet(Value);
|
TargetFrame.UpdateWidgetSet(Value);
|
||||||
|
Loading…
Reference in New Issue
Block a user