浏览代码

* fixed decrementing of refcount of constant ansistrings in setlength()

git-svn-id: trunk@3651 -
Jonas Maebe 19 年之前
父节点
当前提交
9084587bdc
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      rtl/inc/astrings.inc

+ 2 - 1
rtl/inc/astrings.inc

@@ -399,7 +399,8 @@ begin
             movelen := lens;
           Move(Pointer(S)^,Temp^,movelen);
           { ref count dropped to zero in the mean time? }
-          If declocked(PAnsiRec(Pointer(S)-FirstOff)^.Ref) then
+          If (PAnsiRec(Pointer(S)-FirstOff)^.Ref > 0) and
+             declocked(PAnsiRec(Pointer(S)-FirstOff)^.Ref) then
             freemem(PAnsiRec(Pointer(s)-FirstOff));
           Pointer(S):=Temp;
        end;