lcl/interfaces/customdrawn/customdrawnproc.pas has procedure SendFormToBack(ACDForm: TCDNonNativeForm);
This is the original code:
procedure SendFormToBack(ACDForm: TCDNonNativeForm);
var
lCount, lCurIndex: Integer;
begin
// Hide the form
ACDForm.Visible := False;
InitNonNativeForms();
lCount := NonNativeForms.Count;
lCurIndex := NonNativeForms.IndexOf(ACDForm);
{$IFDEF VerboseCDForms}
DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex]));
{$ENDIF}
NonNativeForms.Move(lCurIndex, 0);
end;
It can be noticed that variable lCount has an assigned value at line "lCount := NonNativeForms.Count;" but it's not used at all. Most probably it's presence is due to a copy/paste from the previous in file, procedure BringFormToFront.
procedure BringFormToFront(ACDForm: TCDNonNativeForm);
var
lCount, lCurIndex: Integer;
begin
InitNonNativeForms();
lCount := NonNativeForms.Count;
lCurIndex := NonNativeForms.IndexOf(ACDForm);
{$IFDEF VerboseCDForms}
DebugLn(Format('BringFormToFront lOldIndex=%d lNewIndex=%d', [lCurIndex, lCount-1]));
{$ENDIF}
NonNativeForms.Move(lCurIndex, lCount-1);
end;
The patch removes from SendFormToBack the variable lCount and it's value assignment.
The new code will be:
procedure SendFormToBack(ACDForm: TCDNonNativeForm);
var
lCurIndex: Integer;
begin
// Hide the form
ACDForm.Visible := False;
InitNonNativeForms();
lCurIndex := NonNativeForms.IndexOf(ACDForm);
{$IFDEF VerboseCDForms}
DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex]));
{$ENDIF}
NonNativeForms.Move(lCurIndex, 0);
end;
The patch:
diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pas
index 5170ddc72b..0e8303af08 100644
--- a/lcl/interfaces/customdrawn/customdrawnproc.pas
+++ b/lcl/interfaces/customdrawn/customdrawnproc.pas
@@ -312,13 +312,12 @@ end;
procedure SendFormToBack(ACDForm: TCDNonNativeForm);
var
- lCount, lCurIndex: Integer;
+ lCurIndex: Integer;
begin
// Hide the form
ACDForm.Visible := False;
InitNonNativeForms();
- lCount := NonNativeForms.Count;
lCurIndex := NonNativeForms.IndexOf(ACDForm);
{$IFDEF VerboseCDForms}
DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex]));