Ver código fonte

[jsonSerializer] fixed GenericList SerializeObject memory leak

https://github.com/exilon/QuickLib/issues/59
Exilon 4 anos atrás
pai
commit
e7b4326cf1
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      Quick.Json.Serializer.pas

+ 3 - 3
Quick.Json.Serializer.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Author      : Kike Pérez
   Version     : 1.12
   Version     : 1.12
   Created     : 21/05/2018
   Created     : 21/05/2018
-  Modified    : 16/06/2020
+  Modified    : 12/01/2020
 
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
 
@@ -1188,7 +1188,6 @@ begin
     Exit;
     Exit;
   end;
   end;
 
 
-  Result := TJSONObject.Create;
   try
   try
     //if is GenericList
     //if is GenericList
     if IsGenericList(aObject) then
     if IsGenericList(aObject) then
@@ -1201,7 +1200,8 @@ begin
       Result := TJSONObject(SerializeValue(propvalue));
       Result := TJSONObject(SerializeValue(propvalue));
       {$ENDIF}
       {$ENDIF}
       Exit;
       Exit;
-    end;
+    end
+    else Result := TJSONObject.Create;
     //if is standard object
     //if is standard object
     propertyname := '';
     propertyname := '';
     rType := ctx.GetType(aObject.ClassInfo);
     rType := ctx.GetType(aObject.ClassInfo);