CDirScan function NextL raises "Main Panic KERN-EXEC 0" if it is not called right away SetScanDataL() (i.e. if it is called later within the same active object after another event)
f1() - called within active object
iDirScan = CDirScan::NewLC(aFs);
iDirScan->SetScanDataL(aPath,
KEntryAttDir|KEntryAttMatchExclusive,
ESortNone, CDirScan::EScanDownTree);
//wait for some asynchronous event
f2() - called within the same active object, after some asynchonous event
CDir* dir = NULL;
TRAPD(error, iDirScan->NextL(dir)); -->> "Main Panic KERN-EXEC 0"
If iDirScan->NextL() is called before waiting for some asynchronous event, everything works fine.
Why CDirScan variable looses its validity? Note that the asynchronous event has nothing to do, it can be a simple dummy timer.