Symbian3/PDK/Source/GUID-C6AB2B3A-BBFC-5B57-BECB-F46C96250502.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-C6AB2B3A-BBFC-5B57-BECB-F46C96250502" xml:lang="en"><title>Cleanup
       
    13 stack support for non-CBase classes</title><shortdesc>The cleanup stack supports other types of cleanup using <codeph>CleanupStack::PushL()</codeph>.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>The discussion of clean up so far has assumed objects to be cleaned up
       
    15 are derived from <codeph>CBase</codeph>, with clean up by invoking <codeph>delete</codeph>.
       
    16 Other classes need explicit cleanup support to be provided by the programmer. </p>
       
    17 <p>The cleanup stack supports other types of cleanup. You can push: </p>
       
    18 <ul>
       
    19 <li id="GUID-7BD04FAD-E88D-5549-95DA-B62C5D07493F"><p>a pointer to any type
       
    20 of object. This is an object of type <codeph>TAny*</codeph>. The cleanupstack
       
    21 destroys this type of object with a call to <codeph>User::Free()</codeph> on
       
    22 the pointer pushed. This is less powerful than standard cleanup, because it
       
    23 frees memory and does not call the C++ destructor. </p> <p>You use the <codeph>CleanupStack::PushL(TAny*
       
    24 aPtr);</codeph> overload. </p> </li>
       
    25 <li id="GUID-2D143181-B8B5-5449-B29C-358CE7F8FB4A"><p>a pointer to an object
       
    26 together with a specific cleanup operation for that object. The pointer and
       
    27 the cleanup operation are contained in a <codeph>TCleanupItem</codeph> object. </p> <p>You
       
    28 use the <codeph>CleanupStack::PushL(TCleanupItem anItem)</codeph> overload. </p> <p>You
       
    29 must understand that the <codeph>TCleanupItem</codeph> object does not go
       
    30 on the cleanupstack. The pointer to the object that is contained within the <codeph>TCleanupItem</codeph> object
       
    31 goes on the cleanupstack. For example, if you created a TCleanupItem called
       
    32 myCleanupItem, you must never call <codeph>CleanupStack::Pop(myCleanupItem);</codeph> </p> </li>
       
    33 </ul>
       
    34 <p>Some utility functions are provided that make construction of a suitable <codeph>TCleanupItem</codeph> easy.
       
    35 See <xref href="GUID-18EF9CFA-5080-5F89-89EC-C64897612D6B.dita">How to clean up
       
    36 non-CBase classes</xref>.</p>
       
    37 </conbody></concept>