From e681c29456fbac056a55da5af561f15d9d8654e5 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Wed, 2 May 2012 13:59:12 +0000 Subject: [PATCH] Fixed: List index out of bounds when multiple containers are on a form Fixed: no need to move/remove graphics in the internal list if conversion is disabled --- Source/X2CLGraphicList.pas | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/Source/X2CLGraphicList.pas b/Source/X2CLGraphicList.pas index cf2bf59..1c6b582 100644 --- a/Source/X2CLGraphicList.pas +++ b/Source/X2CLGraphicList.pas @@ -662,8 +662,11 @@ begin opRemove: begin - if AComponent is TX2GraphicContainerItem then - RemoveGraphic(TX2GraphicContainerItem(AComponent)) + if (AComponent is TX2GraphicContainerItem) and + (TX2GraphicContainerItem(AComponent).Container = Self) then + begin + RemoveGraphic(TX2GraphicContainerItem(AComponent)); + end; else if AComponent is TX2GraphicList then Lists.Remove(AComponent); @@ -1263,22 +1266,29 @@ end; procedure TX2GraphicList.DeleteImage(const AIndex: Integer); begin - BeginUpdate; - try - Delete(AIndex); - finally - EndUpdate; - end; + if CanConvert then + begin + BeginUpdate; + try + Delete(AIndex); + finally + EndUpdate; + end; + end else + UpdateImageCount; end; procedure TX2GraphicList.MoveImage(const AOldIndex, ANewIndex: Integer); begin - BeginUpdate; - try - Move(AOldIndex, ANewIndex); - finally - EndUpdate; + if CanConvert then + begin + BeginUpdate; + try + Move(AOldIndex, ANewIndex); + finally + EndUpdate; + end; end; end;