Timer issue?

Jean-Luc Arnaud <jean-luc-E/[email protected]> Wed, 1 Aug 2018 12:43:21 +0200
Newsgroups gmane.comp.lang.realbasic.user
Organization Centre Direct du Multimédia
Message-ID <[email protected]>
Hi all,

I'm using a timer in order to terminate a thread treatment:

- When finished, the thread sets a flag to True and terminates (verified),

- In the Timer (with a period of 10), when the flag is on, the timer 
sets itself to off and then calls a method selecting the next file to be 
treated.

Globally, this works but sometimes, I'm getting a "File already opened" 
error that I send when this method tries to open the same file that is 
already opened. This should never happen !!! It's like the method is 
called again whereas it has already opened a new file and tries to 
reopen it ! I have verified that this is always a new file, never the 
last treated file.

Here is what I'm getting raising a Runtime error when this happens:

RuntimeRaiseException
MainWindow.MainWindow.Next_File%%o<MainWindow.MainWindow>
MainWindow.MainWindow.Refresh_Timer_Action%%o<MainWindow.MainWindow>o<Timer>
XojoFramework$13892
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
__CFRunLoopDoTimer
__CFRunLoopDoTimers
__CFRunLoopRun
CFRunLoopRunSpecific
RunCurrentEventLoopInMode
ReceiveNextEventCommon
_BlockUntilNextEventMatchingListInModeWithFilter
_DPSNextEvent
-[NSApplication(NSEvent) 
_nextEventMatchingEventMask:untilDate:inMode:dequeue:]
XojoFramework$4483
XojoFramework$4484
Application._CallFunctionWithExceptionHandling%%o<Application>p
_Z33CallFunctionWithExceptionHandlingPFvvE
XojoFramework$4483
-[NSApplication run]
RuntimeRun
REALbasic._RuntimeRun
_Main
main

Can you help me understand what's happening ?

TIA

-- 
Jean-Luc Arnaud