Symbian学习笔记19 之 Active Object Pitfalls 

 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:

1. You forgot to call CActiveScheduler::Add() before starting the Active Object.

2. You dont call SetActive() after issuing an async request.

3. 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)

4. Using your own TRequestStatus variable, instead of using the one provided by CActive.

5. Passing automatic variables when doing an asynchronous request.

 

 

一、E32User-CBase 46 Panic 的成因
E32User-CBase 46 的成因除了以下大家熟知的几种情形之外,(参见 Active Object Pitfalls )
  1. 忘记将 CActive 对加入 CActiveScheduler;
  2. 在发起异步请求之后忘记调用 SetActive();
  3. 同时有两个或以上的请求使用同一个 iStatus;
  4. 没有使用 CActive 的 iStatus 成员,而是使用了 TRequestStatus 变量;
  5. 在异步请求中发送了自动变量.

 

 

AO的最常见用法:
SomeAsyncFunc(iStatus); // 提交请求
SetActive(); // 把自己设为活动状态

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值