2
0
Эх сурвалжийг харах

* Added DisposeAndNil (bug ID 28895)

git-svn-id: trunk@33377 -
michael 9 жил өмнө
parent
commit
92b8bf97c0

+ 1 - 0
rtl/objpas/sysutils/sysutilh.inc

@@ -321,6 +321,7 @@ Type
   {$ENDIF}
   
   procedure FreeAndNil(var obj);
+  procedure DisposeAndNil(var p);
 
   { interface handling }
   {$i intfh.inc}

+ 10 - 1
rtl/objpas/sysutils/sysutils.inc

@@ -162,7 +162,16 @@ end;
         temp.free;
       end;
 
-
+    procedure DisposeAndNil(var p);
+    
+    var
+      temp:Pointer;
+    begin
+      temp := Pointer(p);
+      Pointer(P):=nil;
+      FreeMem(temp);
+    end;
+    
   { Interfaces support }
   {$i sysuintf.inc}