delphi TStringList.free 释放错误 invalid pointer operation

时间:2014-11-07 18:36:16   收藏:0   阅读:1434

var
   NeedStr : TStringList;
 begin
  NeedStr := TStringList.Create;

.....

try

   ......

tinally

  needstr.free;  /// 如果needstr值为nil时,直接释放会产生  invalid pointer operation 错误提示.

 //应该改为:       if NeedStr.Count>0 then NeedStr.Free;       

end;

 

原文:http://www.cnblogs.com/smartlittleant/p/4081879.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!