Browse Source

* more correct cleaning of the variant part of TValueData in case a Pointer is larger or equal to QWord in size

git-svn-id: trunk@37062 -
svenbarth 8 years ago
parent
commit
1dccc3469b
1 changed files with 11 additions and 1 deletions
  1. 11 1
      packages/rtl-objpas/src/inc/rtti.pp

+ 11 - 1
packages/rtl-objpas/src/inc/rtti.pp

@@ -537,7 +537,12 @@ end;
 class function TValue.Empty: TValue;
 begin
   result.FData.FTypeInfo := nil;
-  result.FData.FAsUInt64 := 0;
+{$if SizeOf(TMethod) > SizeOf(QWord)}
+  Result.FData.FAsMethod.Code := Nil;
+  Result.FData.FAsMethod.Data := Nil;
+{$else}
+  Result.FData.FAsUInt64 := 0;
+{$endif}
 end;
 
 class procedure TValue.Make(ABuffer: pointer; ATypeInfo: PTypeInfo; out result: TValue);
@@ -551,7 +556,12 @@ type
 begin
   result.FData.FTypeInfo:=ATypeInfo;
   { resets the whole variant part; FValueData is already Nil }
+{$if SizeOf(TMethod) > SizeOf(QWord)}
+  Result.FData.FAsMethod.Code := Nil;
+  Result.FData.FAsMethod.Data := Nil;
+{$else}
   Result.FData.FAsUInt64 := 0;
+{$endif}
   if not Assigned(ABuffer) then
     Exit;
   case ATypeInfo^.Kind of