Symbian
Symbian OS Library

FAQ-0534 Why do I get an E32User-Cbase 46 Panic when cancelling a CMsvOperation

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Messaging
Created: 10/23/2000 Modified: 12/11/2001
Number: FAQ-0534
Platform: ER5

Question:
I have written a messaging application based on the messaging example 'Msgexapp'. However, when I cancel an ongoing CBaseMtmUi::CopyToL operation I get an E32User-Cbase 46 Panic. I understand that this is a stray event panic. What is happening?

Answer:
CMsvOperation derived objects are active objects that represent asynchronous requests to the messaging server. When you create a new CMsvOperation you pass the iStatus of a 'watcher' active object. This 'watcher' gets signalled when the operation completes and can also be used to cancel operations.
In the example code the 'watcher' active object class is called COpComplete. This is it's DoCancel() function:


// If cancelled, cancel outstanding operation
void COpComplete::DoCancel()
{
iMsvOperation->Cancel();
delete iMsvOperation;
TRequestStatus* status = &iStatus ;
User::RequestComplete(status, KErrCancel);
}


There is a bug here. The COpComplete active object's job is to watch for operations to complete. It does not make any asynchronous requests itself. So calling User::RequestComplete() causes a stray event panic (E32User-Cbase 46) as there is no request to complete.

So you need to remove the User::RequestComplete() code:


// If cancelled, cancel outstanding operation
void COpComplete::DoCancel()
{
iMsvOperation->Cancel();
delete iMsvOperation;
}