[Gambas-user] Wait statements > stack overflow (gb3) (oops -typo)

Doriano Blengino doriano.blengino at ...1909...
Fri May 7 09:58:44 CEST 2010


richard terry ha scritto:
> On Friday 07 May 2010 14:29:55 richard terry wrote:
> sorry, misleading code the second Wait was a typo, it should read this:
>
>
>    
>> Hi LIst,
>>
>> I'm automatically parsing many many thousands of pages of documents, the
>> patients are in a listbox, and the documents in another. (with underlying
>> collections of course).
>>
>> The basic code looks like this:
>>
>>      
>   If cvwInboxDocuments.count = 0 Then
>                   '.... do a whole lot of stuff
>        Wait      'make the gui refresh
>     Else
>                 '.... do a whole lot of stuff
>         Wait      'make the gui refresh
>
>    End If
>    
>> When this runs, it looks at each of the some 1800 pages of documents,
>> generated from hl7 files which were previously  parsed into the table by an
>> automated process and converts the essential info to html  for display,
>>   which it resaves and  and does the appropriate linking it needs to do to
>>   patient names, provider names, test names etc.
>>
>> Though this could all run 'under the hood -automaed', I put the Wait
>> statements in so I could see the lists updating on the screen to watch what
>> was happening.
>>
>> If I run the code, after doing about 1/4 of the work it dies on the Wait
>> statement with a 'Stack Overflow' error.
>>
>> If I comment out the Wait statements>  it all runs without a problem.
>>      
I think it is a problem of re-entrancy. When you do a WAIT, other events 
can fire; if one of this events enters again your subroutine, the whole 
thing restarts, and the stack grows more and more. You can put a PRINT 
or a message.xxx at the beginning of your routine, to see if, as 
supposed, it is executed only once. If, during the work, you see two 
messages, then you've found the problem. If this is the case, you must 
use a global variable to avoid to reenter the same routine. If you see 
only one message, then the problem is elsewhere. May be that the 
reentering is somewhere else, though - there is this nice convintions 
that events should be fired even when modifications came from code...

Hope this helps - regards,
Doriano





More information about the User mailing list