>> I'm seeing a curious problem in the interaction of a KeyDown event
>> handler and Valentina. I have an EditField that holds a date. When
>> the date is changed, I retrieve some data from the database and load
>> it into a Listbox. The + and - minus keys increment and decrement the
>> date, and so trigger the database search.
>>
>> The immediate problem is that when I type several + or - quickly, my
>> application crashes silently. Vigorous logging shows that a call is
>> made to Valentina's SQLSelect function before the previous one has
>> returned, which I suspect is causing Valentina to crash. This happens
>> because the EditField.KeyDown event handler is being called in
>> response to a key press before the previous KeyDown event handler has
>> exited; the log data suggests that REALbasic is calling the next
>> KeyDown while Valentina is in the middle of its SQLSelect call.
>>
>> I wonder how this can happen. I guess that somehow a cycle of the
>> event loop is occurring while Valentina is executing an SQLSelect ot
>> something; I am most perplexed. This only occurs when connecting to a
>> remote database; I don't know if Valentina is just so much faster
>> locally that no timing problem occurs, or if there is something more
>> fundamentally different.
I had a similar issue with listbox rows calling for a picture to be drawn
where the location of the picture is stored in a db, and the user can use
the arrow keys to "flip" through them. If you go slowly, all is well, but
just as in your case, if you hit the arrow repeatedly like you know the user
will, a major jam up occurs. I didn't get the crash, but a nil obj
exception.
If I used normal class methods, no matter what I tried, the new calls would
go out before the first had finished.
I was only able to resolve it by threading the db query and using critical
sections to let them pile up behind each other - this works very well so far
but I never could figure out how it was possible that one could go before
the other completed - maybe it is something in the nature of the db driver
that lets go of the main thread?
-seanA
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|