diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-1FC0156C-7BDB-5D5B-9860-837DAB431D24.dita --- a/Symbian3/PDK/Source/GUID-1FC0156C-7BDB-5D5B-9860-837DAB431D24.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-1FC0156C-7BDB-5D5B-9860-837DAB431D24.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,26 +1,26 @@ - - - - - -How to implement and use NewLC()

When an object is created through NewLC(), use CleanupStack::PopAndDestroy() to destroy the object when its use is complete.

static CExample* CExample::NewLC() - { - CExample* self = new (ELeave) CExample(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } void doExampleL() - { - // allocate and push to cleanup stack - leave if failed - CExample* myExample = CExample::NewLC(); - // do something that might leave - myExample->DoSomethingL(); - // pop from cleanup stack and destroy - CleanupStack::PopAndDestroy(); + + + + + +How to implement and use NewLC()

When an object is created through NewLC(), use CleanupStack::PopAndDestroy() to destroy the object when its use is complete.

static CExample* CExample::NewLC() + { + CExample* self = new (ELeave) CExample(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } void doExampleL() + { + // allocate and push to cleanup stack - leave if failed + CExample* myExample = CExample::NewLC(); + // do something that might leave + myExample->DoSomethingL(); + // pop from cleanup stack and destroy + CleanupStack::PopAndDestroy(); }
\ No newline at end of file