Delphi List Out Of Bounds Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions translate error value out of bounds delphi Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a delphi list index out of bounds community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up EListError List index out of bounds delphi list index out of bounds (1) (0) - TForm item up vote 2 down vote favorite I have this interesting bug that I need to fix. I've couple of solutions ready but before I implement one of them I like to ask why such an error may happen. The reason
List Index Out Of Bounds (0) Delphi
I am asking is because I can't replicate this bug so I am kind of implementing a fail recovery solution. The error I get is on a TList object: "[EListError] List index out of bounds (0)". The TList contains few TForm objects where we made them invisible then add them to the TList right after that action. Now we want to make them visible again and free and nil the TList after that. Error happens when we want to make the forms visible again. So there's a loop and list out of bounds error in salesforce the TList.Count has a value. The code gets into loop and the above error happens. Isn't above error implies that there's no item at the specific index but the list count is greater than zero, how could this be? The only out of ordinary thing here might be the for loop counting down so that we display the forms in reverse order. for ii := FormListObject.Count - 1 downto 0 do begin // Error happens here TForm(FormListObject[ii]).Show; end; Do you think this is a gui threading issue, a child item issue or somehow one of the forms got destroyed/killed and the list has a dead reference? Still I thought this error meant that there's no TList item at index 0, dead reference should trigger an access violation error, no? delphi tlist share|improve this question edited May 1 '14 at 17:51 asked May 1 '14 at 15:24 Alex 1721211 That error means you are trying to access the first position of an empty list. Are you sure there is no other list that could cause the problem? –Guillem Vicens May 1 '14 at 16:32 Yea the reason is the thing I am trying to understand. How could this happen, I loose a TForm item in the list but the count value is not decreased. There's no other TList, it's not cleared or modified somewhere else. And since there's no access violation error, I was thinking maybe this is some sort of a synchronization issue with threads running. –Alex May 1 '14 at 17:26 Does the form in th
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more what does list index out of bounds mean about Stack Overflow the company Business Learn more about hiring developers or posting ads
List Index Out Of Bounds (2)
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
List Index Out Of Bounds 2 Delphi
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Delphi - List Index Out Of Bounds(4) up vote 2 down vote favorite http://stackoverflow.com/questions/23410796/elisterror-list-index-out-of-bounds-0-tform-item 1 I know this question has been brought up a million times, however, I cant understand why this code is throwing the error, I have tracked down the culprit FOR loop causing the error, however, I don't see anything wrong with it. I'm getting the error - "List Index Out Of Bounds(4)" function TNetwork.FeedForward(InputVals : array of Real) : Real; var I : Integer; begin for I := 0 http://stackoverflow.com/questions/32106343/delphi-list-index-out-of-bounds4 to Length(InputVals)-1 do begin Input[I].Input(InputVals[I]); end; for I := 0 to Length(Hidden)-1 do begin Hidden[I].CalcOutput; end; Output.CalcOutput; Result := Output.GetOutput; end; The error occurs on the second For Loop, here is where I set the size of the hidden array. constructor TNetwork.Create(Inputs, HiddenTotal : Integer); var C : TConnection; I, J : Integer; begin LEARNING_CONSTANT := 0.5; SetLength(Input,Inputs+1); SetLength(Hidden,HiddenTotal+1); So, as I see it, the loop executes only three times, so why is it trying to index the 4th space? never mind why, more importantly, HOW? If someone could shed some light on the cause, and a possible fix, I would be ever grateful For completion's sake, here is the complete unit.. unit NeuralNetwork_u; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, Math; type TConnection = Class; TNeuron = class(TObject) protected Output : Real; Connections : TList; isBias : Boolean; public Constructor Create; overload; Constructor Create(BiasValue : Integer); overload; procedure CalcOutput; procedure AddConnection( Con : TConnection ); function GetOutput : Real; Function F( X : Real ) : Real; end; TConnection = class private nFrom, nTo : TNeuron; Weight : Real; public constructor Create(a , b : TNeuron) ; overload; constructor Create(a, b : TNeuron ; W : Real) ; overload; functio
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/8778857/list-index-out-of-bounds-0 the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping out of each other. Join them; it only takes a minute: Sign up list index out of bounds (0) up vote 2 down vote favorite 1 i posted a question on Fixing an error in a method declaration in a form in Delphi but after getting it fixed another error popped up upon compiling and its saying project project1.exe raised out of bounds exception class EStringListError with message 'list index out of bounds(0)'.when i press continue its not working but when i press break its flashing on the code neraz:=true; this is my code below Procedure Reload; var i:integer; begin form1.ListBox1.Clear; form1.ListBox2.Clear; if neraz then HD; neraz:=true;//..................here form1.Label3.Caption:='free: '+inttostr(vs*32)+' byte'+#10#13+'cluster size = 32 bytes'; i:=TABLE[nk1].nach; KolP1:=0; KolP2:=0; while (FAT[i]<>1024) do begin if TABLE[fat[i]].tip then begin form1.ListBox1.Items.Add('dir>'+TABLE[fat[i]].name); inc(kolP1); end else if TABLE[fat[i]].format='txt' then form1.ListBox1.Items.Add('f_text> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format) else form1.ListBox1.Items.Add('f_bin> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format); if (fat[i]<>0) then i:=fat[i]; end; i:=TABLE[nk2].nach; while (FAT[i]<>1024) do begin if TABLE[FAT[i]].tip then begin form1.ListBox2.Items.Add('dir>'+TABLE[fat[i]].name); inc(kolP2) end else if TABLE[fat[i]].format='txt' then form1.ListBox2.Items.Add('f_text> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format) else form1.ListBox2.Items.Add('f_bin> '+TABLE[fat[i]].name+'.'+TABLE[fat[i]].format); if (fat[i]<>0) then i:=fat[i]; end; vfail; end; procedure HD; var i: integer; begin for i := 0 to 49 do begin with form2.ListView1.Items[i] do begin SubItems[0] := TABLE[i].name; SubItems[1] := TABLE[i].format; if TABLE[i].tip then SubItems[2] := 'folder' else SubItems[2] := 'file'; SubItems[3] := IntToStr(TABLE[i].nach); SubItems[4] := IntToStr(TABLE[i].razmer); end; form2.ListView2.Items[i].SubItems[0] := IntToStr(fat[i]); end; end; delphi share|improve this question edited Jan 8 '12 at 16:20 asked Jan 8 '12 at 15:45 Mildred Shimz 262518