prevent null pointer access crashes/memory trashing.
[AROS.git] / rom / oop / disposeobject.c
blobec9d1afc163b98658b1aecfc888e09bb18ca0d39
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a new OOP object
6 Lang: english
7 */
8 #include <exec/lists.h>
9 #include <proto/exec.h>
10 #include "intern.h"
11 #define MD(x) ((struct metadata *)x)
12 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/oop.h>
19 AROS_LH1(VOID, OOP_DisposeObject,
21 /* SYNOPSIS */
22 AROS_LHA(OOP_Object *, obj, A0),
24 /* LOCATION */
25 struct Library *, OOPBase, 10, OOP)
27 /* FUNCTION
28 Delete an object that was previously allocated with OOP_NewObject().
30 INPUTS
31 obj - pointer to object to dispose.
33 RESULT
34 None.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 OOP_NewObject()
45 INTERNALS
47 HISTORY
48 29-10-95 digulla automatically created from
49 intuition_lib.fd and clib/intuition_protos.h
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 ULONG mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
57 EnterFunc(bug("OOP_DisposeObject(classID=%s)\n",
58 OOP_OCLASS(obj)->ClassNode.ln_Name));
60 if (obj == NULL) return;
62 OOP_DoMethod(obj, (OOP_Msg)&mid);
64 ReturnVoid("OOP_DisposeObject");
66 AROS_LIBFUNC_EXIT
67 } /* OOP_DisposeObject */