After a crash, I want my app on next launch to programmatically close any of its databases left open. There does not seem to be any good way to do this selectively -- that is, no way to relate the LocalID of a database found to be open still, to the DmOpenRef returned by using DmNextOpenDatabase in a loop. So I tried programmatically closing all open databases using the latter in the loop, with a DmCloseDatabase call for each returned DmOpenRef that was non null. But there was no way to limit this to just my app's databases, and it didn't seem to work anyway - well, it crashed the CodeWarrior IDE each time I tried (my debug target is a real Dana machine), and using FileZ afterwards I discovered the open databases that appeared to be being closed as I stepped through in the debugger were still open.
It's looking like I have to build my application in such a way that any exception likely to result in a 'serious' crash must be caught and the databases closed down before the effects of the exception destabalise the running of the app and the crash 'happens'. I can do this most of the time, but I doubt I can ensure it will never bypass my protection mechanisms when it crashes (for expediency, and app responsiveness, I have to make assumptions that most errors won't happen, and just try to catch the more likely ones - especially memory manager ones); and I despair of having to write an app that will never crash. Surely I don't have to tell my users they must have FileZ and learn how to use it to close the left-open databases manually? (My app maintains about 10, 8 of which are open while it is running.) Opening and closing databases for every record access would make the app prohibitively slow; but leaving the databases open while the app runs appears to be an invitation to disaster for users. (My users will be village people who for the most part will never have used a computer before.) Is there a way round this problem? It is making me intensely dislike the Palm OS as a development environment. Any help out there? --Bruce Waters -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
