Răsfoiți Sursa

* Clean fix for bug #9170. Thanks Peter.

git-svn-id: trunk@7911 -
yury 18 ani în urmă
părinte
comite
8379edbb5d
1 a modificat fișierele cu 5 adăugiri și 7 ștergeri
  1. 5 7
      rtl/inc/wstrings.inc

+ 5 - 7
rtl/inc/wstrings.inc

@@ -195,6 +195,9 @@ begin
   S:=Nil;
 end;
 
+var
+  __data_start: byte; external name '__data_start__';
+  __data_end: byte; external name '__data_end__';
 
 Procedure fpc_WideStr_Decr_Ref (Var S : Pointer);[Public,Alias:'FPC_WIDESTR_DECR_REF']; compilerproc;
 {
@@ -222,13 +225,8 @@ Begin
     { Ref count dropped to zero ...
       ... remove }
 {$else}
-  { Here we check if widestring is constant (located in .data section).
-    initialstklen variable is compiler generated and always located at the beginning of .data section.
-    ExitCode is zero initialized variable and located somewhere in .bss section which is followed
-    by .data section in memory.
-    If widestring points to the address space between initialstklen and ExitCode then it is constant
-    and there is no need to dispose it. }
-  if (S<@initialstklen) or (S>@ExitCode) then
+  { Here we check if widestring is not constant (located in .data section). }
+  if (S<@__data_start) or (S>=@__data_end) then
 {$endif FPC_WINLIKEWIDESTRING}
     DisposeWideString(S);
 end;