From 9609ea720b81368de35fc3e8721f9a836e15d666 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 15 Mar 2015 11:15:16 +0000 Subject: [PATCH] IdeIntf: Prevent a crash when Action is deleted in ActionsEditor. Issue #27624 git-svn-id: branches/fixes_1_4@48366 - --- components/ideintf/actionseditor.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/ideintf/actionseditor.pas b/components/ideintf/actionseditor.pas index 2fcd556b08..f8f353da71 100644 --- a/components/ideintf/actionseditor.pas +++ b/components/ideintf/actionseditor.pas @@ -135,6 +135,7 @@ type protected procedure OnComponentRenamed(AComponent: TComponent); procedure OnComponentSelection(const NewSelection: TPersistentSelectionList); + procedure OnComponentDelete(APersistent: TPersistent); procedure OnRefreshPropertyValues; function GetSelectedAction: TContainedAction; procedure Notification(AComponent: TComponent; Operation: TOperation); @@ -757,6 +758,16 @@ begin ACanvas.DrawFocusRect(ARect); end; +procedure TActionListEditor.OnComponentDelete(APersistent: TPersistent); +var + i: Integer; +begin + if not (APersistent is TContainedAction) then Exit; + i := lstActionName.Items.IndexOfObject(APersistent); + if i >= 0 then + lstActionName.Items.Delete(i); +end; + procedure TActionListEditor.SBShowMenuNewActionsClick(Sender: TObject); var MousePoint: TPoint; @@ -891,6 +902,7 @@ begin GlobalDesignHook.AddHandlerComponentRenamed(@OnComponentRenamed); GlobalDesignHook.AddHandlerSetSelection(@OnComponentSelection); GlobalDesignHook.AddHandlerRefreshPropertyValues(@OnRefreshPropertyValues); + GlobalDesignHook.AddHandlerPersistentDeleting(@OnComponentDelete); AddActionEditor(Self); end;