Hello, everybody.

I have problems with RThread.

I use next line to call function in separate thread:
Code:
        TInt res = iHashingPHThread.Create(KPBHashingThread, PhoneBookChanged, KDefaultStackSize, NULL, (TAny*) this);

        if (res == KErrNone)
        {
            iHashingPHThread.Resume();
        }
This is my function:
Code:
TInt CCommonStorage::PhoneBookChanged(TAny* pObj)
{
	LOGF(_L("+ CCommonStorage::PhoneBookChanged()"));

	CTrapCleanup* cleanupStack = CTrapCleanup::New();
	
	const CContactIdArray *itemArray = storage->GetDataBase()->SortedItemsL(); // just return array with contacts

	storage->GetABChecksum(itemArray);

	delete cleanupStack;
	cleanupStack = NULL;
	    
	return 0;
}

TBool CCommonStorage::GetABChecksum(const CContactIdArray *itemArray)
{
	for (int i = 0; i < count; ++i)
	{
		TContactItemId itemID = (*itemArray)[i];

		CContactItem *item = NULL;
		item = pDatabase->ReadMinimalContactL(itemID); // exception cbase66

		// do smth
	}

	return ret;
}
Actually I cannot perform any operations with stack. Where is my mistake and what should I do to fix it?

Thank you.