程序已关闭,user 42.
程序编译无问题,出现上述错误,得知是指针被重复删除,可我检查了半天,不知哪一句出的问题,求高手告知
{
TBuf<20> number(_L(""));
TBuf<128> callNameBuf;
TBuf<20> firstname(_L(""));
CAknTextQueryDialog* dialog=CAknTextQueryDialog::NewL(number);//声明登陆对话框对象
if (dialog->ExecuteLD(R_LICH_KING_CONTAINER_DATA_QUERY2))
{
CPbkContactEngine* iContactsDb = CPbkContactEngine::NewL();
CleanupStack::PushL(iContactsDb);
CContactIdArray* iMyIdArray = iContactsDb->MatchPhoneNumberL(number, 15);
CleanupStack::PushL(iMyIdArray);
callNameBuf.AppendNum(iMyIdArray->Count());
CEikonEnv::InfoWinL(_L("Count of Matches"),callNameBuf);
for (TInt i = 0; i < iMyIdArray->Count(); i++)
{
TContactItemId id = (*iMyIdArray)[i];
CPbkContactItem* contact = iContactsDb->ReadContactL(id);
CleanupStack::PushL(contact);//2
CAknTextQueryDialog* dialog=CAknTextQueryDialog::NewL(firstname);//声明登陆对话框对象
if (dialog->ExecuteLD(R_LICH_KING_CONTAINER_DATA_QUERY3))
{
TPbkContactItemField* field = contact->FindField(EPbkFieldIdFirstName);
CleanupStack::PushL(field);//1
field->TextStorage()->SetTextL(firstname);
iContactsDb->CommitContactL(*contact);
CleanupStack::PopAndDestroy(field);
}
CleanupStack::PopAndDestroy(contact);
}
CleanupStack::PopAndDestroy(iMyIdArray);
CleanupStack::PopAndDestroy(iContactsDb);
}
}
[解决办法]
原因知道了,是field属于T类,而清除栈只适用于C类和R类,但之后又出现了系统错误-21,有谁知道如何解决么,-23是因为缺少能力我知道,但是-21用同样的方法好像无法解决呀
[解决办法]
-21的问题是我一个应该用open的地方用了read,结贴