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
         begin
           result:=ClassName;
           result:=ClassName;
         end;
         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
                                TINTERFACEDOBJECT

+ 5 - 0
rtl/inc/objpash.inc

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