if Assigned(TComboBox.Items.Objects[i]) then 
   TComboBox.Items.Objects[i].free; 释放过了 还是返回true

解决方案 »

  1.   

    if   Assigned(TComboBox.Items.Objects[i])   then  
    begin
          TComboBox.Items.Objects[i].Free;  
          TComboBox.Items.Objects[i] := nil; 
    end;
      

  2.   

    budded 
    All By Myself 
    等 级:
     发表于:2008-01-24 16:25:031楼 得分:0 
    if       Assigned(TComboBox.Items.Objects[i])       then     
    begin 
                TComboBox.Items.Objects[i].Free;     
                TComboBox.Items.Objects[i]   :=   nil;   
    end; 
     
    ===================================================
    我用freeandnil(TComboBox.Items.Objects[i]) 就不行 2者有什么区别 呢 
      

  3.   

    procedure FreeAndNil(var Obj);
    var
      Temp: TObject;
    begin
      Temp := TObject(Obj);
      Pointer(Obj) := nil;
      Temp.Free;
    end;
      

  4.   

    var
      nObject: TObject;
    begin
    ...
      nObject := TComboBox.Items.Objects[i];
      if Assigned(nObject) then 
        FreeAndNil(nObject);
    ...