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

* Add Delphi-compatible DisposeOf and friends.

Michaël Van Canneyt 1 жил өмнө
parent
commit
6045b3a6bd

+ 17 - 0
rtl/inc/objpas.inc

@@ -1054,6 +1054,23 @@
         begin
           result:=ClassName;
         end;
+        
+      procedure TObject.DisposeOf;
+      begin
+        Free;
+      end;
+      
+      function TObject.GetDisposed : Boolean;
+      
+      begin
+        Result:=False;
+      end;    
+      
+      procedure TObject.CheckDisposed;
+      
+      begin
+        // Do nothing since we have no reference count.
+      end;
 
 {****************************************************************************
                                TINTERFACEDOBJECT

+ 5 - 0
rtl/inc/objpash.inc

@@ -216,6 +216,8 @@
        {$endif FPC_HAS_FEATURE_ANSISTRINGS}
 
        TObject = class
+       protected
+          function GetDisposed : Boolean; inline;
        public
           { please don't change the order of virtual methods, because
             their vmt offsets are used by some assembler code which uses
@@ -268,6 +270,9 @@
           { new since Delphi 2009 }
           class function UnitName : RTLString;
           class function QualifiedClassName: RTLString;
+          Procedure DisposeOf; inline;
+          Procedure CheckDisposed; inline;
+          Property Disposed : Boolean Read GetDisposed;
           function Equals(Obj: TObject) : boolean;virtual;
           function GetHashCode: PtrInt;virtual;
           function ToString: RTLString; virtual;