急救!!!delphi中编写多线程程序出现list out of bounds(????),怎么解决
各位高手,为什么??????????
谢谢!

解决方案 »

  1.   

    procedure TAnimThread.Execute;
      var i:integer;
      begin
        for i:=0 to 12
        do
        begin
          Synchronize(ChangeXY);//改变动态生成image的位置
          sleep(800);
        end;
         threadimage.free;
         freeonterminate:=true;
      end;
      

  2.   

    Synchronize是你自己编的吧?
    反正就是数组越界呗,在Synchronize里慢慢找总能找到的.
      

  3.   

    procedure TAnimThread.ChangeXY;
      var cur_x,cur_y:Integer;
      begin
        try
        begin
          Threadimage.hide;
          cur_x:=source_x + trunc((destination_x - source_x)/13) * cur_count;
          cur_y:=source_y + trunc((destination_y - source_y)/13) * cur_count;
          cur_count:=cur_count + 1;
          ThreadImage.Left:=cur_x;
          ThreadImage.Top :=cur_y;
          threadimage.show;
        end
        except
        end;
      end;
      

  4.   

    ThreadImage.Left 或是 ThreadImage.Top 超出范围。
      

  5.   

    cur_count:=cur_count + 1;这里会无限增大的!
      

  6.   

    在线程中每调用一次 ChangeXY ,cur_count 就会加1,
    如此下去就会超出范围!
      

  7.   

    你在改变list的时候并且进行了排序操作!
      

  8.   

    我也遇到,不过是TMemoryStream时