Jump to content

wpclsUnInitData

From EDM2
Revision as of 16:17, 28 May 2025 by Martini (talk | contribs) (Parameters)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This method is called to allow the class object to free allocated resources.

Syntax

wpclsUnInitData(somSelf);

Parameters

somSelf (M_WPObject *) - input
Pointer to the WPObject class object.

Returns

There is no return value for this method.

Usage

This method is generally called only by the system when the class object is made dormant. The class object is made dormant when the last instance of this class is made dormant.

How to Override

Any class that overrides the wpclsInitData method to allocate resources for its metaclass instance variables should override this method to deallocate those resources. It is essential to pass this method onto the parent class object after performing override processing.

Example Code

Declaration:

#define INCL_WINWORKPLACE
#include <os2.h>

M_WPObject     *somSelf;       /*  Pointer to the WPObject class object. */

wpclsUnInitData(somSelf);

This example overrides the method to free any data associated with the class.

SOM_Scope void SOMLINK BearsM_wpclsUnInitData(M_Bears *somSelf)
{
    APIRET  rc  =  NO_ERROR;            /* Return code from Dos API */

    M_BearsData *somThis = M_BearsGetData(somSelf);
    M_BearsMethodDebug("M_Bears","myfM_wpclsUnInitData");

    rc = DosFreeMem( _pBearClassData );

    parent_wpclsUnInitData(somSelf);

}

Related Methods