Don't call InvertPixelArray with negative width and/or height.
[tangerine.git] / workbench / libs / muimaster / mui_freeclass.c
blobc0da8f29506fae94994098f45f2f4ba5fcc9e12a
1 /*
2 Copyright © 2002-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <string.h>
8 #include <proto/muimaster.h>
9 #include <proto/intuition.h>
10 #include <proto/exec.h>
12 #include "muimaster_intern.h"
13 #include "support_classes.h"
14 #include "debug.h"
16 /*****************************************************************************
18 NAME */
19 AROS_LH1(VOID, MUI_FreeClass,
21 /* SYNOPSIS */
22 AROS_LHA(Class *, cl, A0),
24 /* LOCATION */
25 struct Library *, MUIMasterBase, 14, MUIMaster)
27 /* FUNCTION
28 Frees a class returned by MUI_GetClass().
30 INPUTS
31 cl - The pointer to the class.
33 RESULT
34 VOID - The function always succeed: if the class can't be
36 NOTES
37 This function is obsolete, DO NOT use it.
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 MUI_GetClass(), MUI_CreateCustomClass(), MUI_DeleteCustomClass()
46 INTERNALS
48 HISTORY
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
53 AROS_LIBBASE_EXT_DECL(struct MUIMasterBase *, MUIMasterBase)
55 ObtainSemaphore(&MUIMB(MUIMasterBase)->ZuneSemaphore);
57 /* CLF_INLIST tells us that this class is a builtin class */
58 if (cl->cl_Flags & CLF_INLIST)
60 Class *super = cl->cl_Super;
62 if (--cl->cl_Dispatcher.h_Data == 0)
64 ZUNE_RemoveBuiltinClass(cl, MUIMasterBase);
66 if (FreeClass(cl))
68 CloseLibrary(MUIMasterBase);
69 if (strcmp(super->cl_ID, ROOTCLASS) != 0)
70 MUI_FreeClass(super);
72 else
74 /* Re-add the class to the list since freeing it failed */
75 ZUNE_AddBuiltinClass(cl, MUIMasterBase);
77 /* And also increase the reference counter again */
78 cl->cl_Dispatcher.h_Data++;
82 ReleaseSemaphore(&MUIMB(MUIMasterBase)->ZuneSemaphore);
84 else
86 ReleaseSemaphore(&MUIMB(MUIMasterBase)->ZuneSemaphore);
88 CloseLibrary((struct Library *)cl->cl_Dispatcher.h_Data);
91 AROS_LIBFUNC_EXIT
93 } /* MUIA_FreeClass */