Active Object Pitfalls
Article Metadata
A stray-event panic from the Active Scheduler ( E32USER-CBASE 46 error ) is a most common problem with an Active Objects. This is ussually caused by one ( or more ) of the following:
- You forgot to call CActiveScheduler::Add() before starting the Active Object.
- You dont call SetActive() after issuing an async request.
- Passing the same iStatus to two service providers at the same time ( multiple requests outstanding on the same Active Object ).
Do not invoke DoCancel() directly - it should be private - always call Cancel(). Note that Cancel() should be always be called in the destructor of your derived class.
Other related pitfalls (triggering other panics):
- Using your own TRequestStatus variable, instead of using the one provided by CActive.
- Passing automatic variables when doing an asynchronous request.
Careless use of active objects can degrade the response time of UI in case of:
- Priority of active object is higher than it is necessary
- Method RunL() works too long


02 Sep
2009
Understanding of how the active objects work, as well as often using of this paradigm - the daily practice of a common Symbian C++ developer. At first time the newcomers often have problems associated with this paradigm. This article contains a list of possible causes and ways to solve the most common error that occurs when using active objects: E32USER-CBASE 46 panic. I think everyone developer faced this panic :)
Content of this article is small, but very useful. Many beginners who are studying the active objects paradigm must thoroughly understand the reason of this error. This will save time and improve the final quality of the code.