Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-0715E8B9-8F43-5C7B-BDC6-4E8FA5352714" xml:lang="en"><title>Cleanup
following trap harnesses</title><shortdesc>Some cleanup requirements must be handled by the cleanup code after
the trap harness.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Some cleanup requirements must be handled by the cleanup code after the
trap harness, on discovering that the leave code is not <codeph>KErrNone</codeph>.
The cleanup requirements may include:</p>
<ul>
<li id="GUID-3F81400F-8343-50A9-9076-D342AB8FA85C"><p>rolling back changes
to restore an object to the state it was in before the function which left
was invoked</p> <p>For instance, a “set font” command might have been issued
for some characters in a line, and might fail because of lack of memory: the
line should be restored to its previous state.</p> <p>Rollback is not always
easy. Often, it’s simpler to prepare a change that would be guaranteed to
work, and apply it if the change was prepared successfully. If a leave occurred
in the act of preparing a change, the change can be destroyed. It’s usually
easier to destroy a change than to roll it back.</p> </li>
</ul>
<ul>
<li id="GUID-CD29C562-17AE-50D6-A629-FFCE70B60545"><p>destroying a partially-constructed
object</p> <p>Most requirements for destroying partially-constructed objects
will be dealt with by the cleanup stack. There may be a requirement to destroy
some partially-constructed objects as part of rollback processing. </p> </li>
</ul>
<ul>
<li id="GUID-4E8F6B7C-009E-5EC6-BBB9-A737B16CDBBD"><p>closing files and other
such resources, where this is not encapsulated in use of the cleanup stack.</p> </li>
</ul>
</conbody></concept>