The code is written so that it doesn't use any global or static variables. This works fine on the Tungsten E simulator, using HostFS to simulate a card with a directory on the PC. True, I can't "insert a card" in the simulator - but the sysNotifyVolumeMountedEvent event is broadcast on soft reset too (makes sense - the volume has to be mounted during reset), and when I reset the simulator, my application is launched and it scans the card.
However, when I try it on a real device (Tungsten E), as soon as I insert a card (or during reset, if a card is left in the slot) I get a system crash with the memory manager complaining about a NULL pointer. I've been using a FrmCustomAlert to display debugging messages and, interestingly, the custom alert is flashed on the screen - but there is no waiting for the user to tap on its button; instead I immediately get the message for the crash.
Another thing. The crash does not happen and the application scans the inserted card properly, if the application was running at the moment when the card was inserted.
Any hints what might be the problem? The documentation explicitly says that you *can* use the user interface during notifications. Yet the program crashes as if there is no current form or something. And why doesn't it crash under the simulator? Is there anything obviuous that I might be missing?