TQuery::Open in TQuery::Run crashes IDE


2006-06-09 11:53:32 PM
cppbuilder52
I'm using BC 5.02, OWL 5.0 & BDE 3.0. You might put this project in
the "legacy systems" category. The system works fine, but somebody
said "hey, lets have it grab the data automatically from our new
database".
I felt that the users wouldn't like the apparent performance delay of
TQuery::Open when opening the program, and I decided that the data
wouldn't be needed until the user made certain requests, which would
give a seperate thread plenty of time to finish a query without anybody
ever noticing. So I've got a TQuery inside a TThread. Actually, I've
got two different threads for two different queries to two different
databases.
The first thread can run for weeks, with a new thread starting every
minute (the thread takes less than a minute to run), with no problems
that I can see. No unhandled exceptions, no CodeGuard messages, no
crashes, looks fine.
When run consecutively, the second thread (which is basically a clone
of the first thread that handles a larger query) will crash out the
Borland IDE and the debugging environment that it is running under
after just a few iterations. Commenting out sections of my own code,
stepping through the thread in the de{*word*81}, I've come to the
conclusion that the crash takes place in TQuery::Open. The only way to
avoid this crash is not to open the query. If I run the thread just
once, and exit, I get an error that the de{*word*81} identifies as taking
place in the destructor of ~TQuery, which is implicitly called in the
destructor of my thread.
So okay.
Question one: Do I have a bug in my program? My perspective is that a
program should never crash in any circumstance, so if program A crashes
program B (dll, exe, ide, etc), then program B is the one with the bug.
If windows reports that bcw.exe has crashed, then bcw.exe has a bug.
But is there also a bug in my program? Will my program deploy fine
running under WinXP? Is it impossible to crash the de{*word*81} unless you
also have a bug or unhandled exception or something in your own
program?
Question two: Is there a patch for BC5.2, OWL 5.0 or BDE 3.0 that
wouldn't crash? Admittedly my first suspect should be the parameters
that I'm sending, but I'm seeing clues that the actual bug may be a bug
in any of them. I checked support.borland.com and couldn't find
patches for products that old. How do I know which patches I already
have?