View Issue Details

IDProjectCategoryView StatusLast Update
0035226PatchesIDEpublic2019-03-16 21:07
ReporterAntonAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0035226: Crash on TAction renaming
DescriptionIf ActionList editor is shown, renaming of the actions may lead to AV.
Provided patch uses adapted version of the code from TActionListEditor.OnComponentDelete.
Steps To Reproduce1. Project -> New Project... -> Application
2. Add ActionList (ActionList1)
3. Double click ActionList1 and add new Action (Action1)
4. Don't close "ActionList Editor" and drop MainMenu component on the form
5. Double click MainMenu1 to open MenuEditor
6. Click "Add menu item" to add new menu item (MenuItem1)
MenuItem1 is an active component, its properties are shown in Object Inspector.
7. Change MenuItem1.Action property to "Action1" in Object Inspector
8. Expand current row ("Action") of Object Inspector to make also visible the properties of Action1
9. Change property Name of Action1 to "Action12"
TagsNo tags attached.
Fixed in Revisionr60677
LazTarget-
Widgetset
Attached Files
  • actionseditor.pas.patch (839 bytes)
    Index: components/ideintf/actionseditor.pas
    ===================================================================
    --- components/ideintf/actionseditor.pas	(revision 60669)
    +++ components/ideintf/actionseditor.pas	(working copy)
    @@ -468,11 +468,13 @@
     end;
     
     procedure TActionListEditor.OnComponentRenamed(AComponent: TComponent);
    +var
    +  i: Integer;
     begin
    -  if Assigned(FActionList)
    -  and (AComponent is TAction) and (TAction(AComponent).ActionList = FActionList)
    -  and Assigned(FActionList.ActionByName(AComponent.Name)) then
    -    lstActionName.Items[lstActionName.ItemIndex] := AComponent.Name;
    +  if not (AComponent is TContainedAction) then Exit;
    +  i := lstActionName.Items.IndexOfObject(AComponent);
    +  if i >= 0 then
    +    lstActionName.Items[i] := AComponent.Name;
     end;
     
     procedure TActionListEditor.OnComponentSelection(
    

Activities

Anton

2019-03-14 20:56

reporter  

actionseditor.pas.patch (839 bytes)
Index: components/ideintf/actionseditor.pas
===================================================================
--- components/ideintf/actionseditor.pas	(revision 60669)
+++ components/ideintf/actionseditor.pas	(working copy)
@@ -468,11 +468,13 @@
 end;
 
 procedure TActionListEditor.OnComponentRenamed(AComponent: TComponent);
+var
+  i: Integer;
 begin
-  if Assigned(FActionList)
-  and (AComponent is TAction) and (TAction(AComponent).ActionList = FActionList)
-  and Assigned(FActionList.ActionByName(AComponent.Name)) then
-    lstActionName.Items[lstActionName.ItemIndex] := AComponent.Name;
+  if not (AComponent is TContainedAction) then Exit;
+  i := lstActionName.Items.IndexOfObject(AComponent);
+  if i >= 0 then
+    lstActionName.Items[i] := AComponent.Name;
 end;
 
 procedure TActionListEditor.OnComponentSelection(

Juha Manninen

2019-03-15 12:24

developer   ~0114833

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-03-14 20:56 Anton New Issue
2019-03-14 20:56 Anton File Added: actionseditor.pas.patch
2019-03-15 01:20 Juha Manninen Assigned To => Juha Manninen
2019-03-15 01:20 Juha Manninen Status new => assigned
2019-03-15 12:24 Juha Manninen Fixed in Revision => r60677
2019-03-15 12:24 Juha Manninen LazTarget => -
2019-03-15 12:24 Juha Manninen Note Added: 0114833
2019-03-15 12:24 Juha Manninen Status assigned => resolved
2019-03-15 12:24 Juha Manninen Resolution open => fixed
2019-03-16 21:07 Anton Status resolved => closed