瀏覽代碼

* fixed bug #9187.
+ test.

git-svn-id: trunk@7876 -

yury 18 年之前
父節點
當前提交
fd4f90d3ff
共有 3 個文件被更改,包括 26 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 1 0
      rtl/inc/wstrings.inc
  3. 24 0
      tests/webtbs/tw9187.pp

+ 1 - 0
.gitattributes

@@ -8328,6 +8328,7 @@ tests/webtbs/tw9139a.pp svneol=native#text/plain
 tests/webtbs/tw9167.pp svneol=native#text/plain
 tests/webtbs/tw9174.pp svneol=native#text/plain
 tests/webtbs/tw9179.pp svneol=native#text/plain
+tests/webtbs/tw9187.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 1 - 0
rtl/inc/wstrings.inc

@@ -381,6 +381,7 @@ Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer);[Public,Alias:'FPC_
 }
 begin
 {$ifdef FPC_WINLIKEWIDESTRING}
+  if S1=S2 then exit;
   { Decrease the reference count on the old S1 }
   fpc_widestr_decr_ref (S1);
   if S2<>nil then

+ 24 - 0
tests/webtbs/tw9187.pp

@@ -0,0 +1,24 @@
+var
+ wstr1: widestring;
+
+procedure testproc(const avalue: widestring);
+begin
+ wstr1:= avalue;
+end;
+
+var
+  i: longint;
+  w2: widestring;
+
+begin
+ setlength(w2, 200000);
+ for i:=1 to length(w2) do
+   w2[i]:=Chr(i mod $60 + $20);
+ wstr1:=w2;
+ testproc(wstr1);
+ if wstr1<>w2 then begin
+   writeln('Test failed!');
+   Halt(1);
+ end;
+ writeln('Test OK.');
+end.