views:

161

answers:

2

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.

+2  A: 

I wrote some test code in an attempt to reproduce this but couldn't.

Generally, KERN-EXEC 0 panics are most often caused by stale R object handles. For example, make sure that the RFs handle you pass to CDirScan is not closed too early.

laalto
Absolutely true. Thank you, laalto.
Bojan Milankovic
A: 

Could you post more of your code to analyze?

Does this two parts of code are in different functions f1, f2, or both are in one function f1, this is not clear for me?

Also if iDirScan is part of your class you shouldn't leave it on cleanup stack (NewLC) function.

Michal
I accidentally destroyed the RFs session in f1. This is why my code did not work.
Bojan Milankovic