Frees a boopsi class created by MakeClass().
Source position: intuition.pas line 3929
function FreeClass( |
ClassPtr: PIClass |
):LongBool; |
Returns False if the class could not be freed. Reasons include, but will not be limited to, having non-zero cl_ObjectCount or cl_SubclassCount. Returns True if the class could be freed. Calls RemoveClass() for the class in either case.
For class implementors only.
Tries to free a boopsi class created by MakeClass(). This won't always succeed: classes with outstanding objects or with subclasses cannot be freed. You cannot allow the code which implements the class to be unloaded in this case.
For public classes, this function will always remove the class (see RemoveClass() ) making it unavailable, whether it succeeds or not.
If you have a dynamically allocated data for your class (hanging off of cl_UserData), try to free the class before you free the user data, so you don't get stuck with a half-freed class.
Snippet
// Free a public class with dynamic memory in cl_UserData function freeMyClass(cl: PClass): Boolean; var mpcd: PMyPerClassData; begin Result := False; mpcd = PMyPerClassData(cl^.cl_UserData); if FreeClass(cl) then begin FreeMem(mpcd, SizeOf(TMyPerClassData)); Result := True; end; end;
|
Create and initialize a boopsi class. |