I get sometimes a crash on my application for ThreadAccessingUIException.
The problem is this only happens rarely, and Im pretty sure my thread doesnt access the UI.
Very short code in the Thread.Run:
try
result.ExecuteMT
catch err as SQLErrorExceptionMBS
// catch errors but delegate showing a message to avoid
// accessing the UI from a thread
lastException = err
errorInSearch = true
end try
Well, it may be a Xojo internal method, but it’s still calling a UI element (window) from the thread. Use the Task Thread in the examples folder to call/update anything in the main thread.
The only code accessing the UI is in the timer.Action event. The thread itself only launch a database search and set a couple of properties when something goes wrong. And even the latter case, I tried and it works.
Strange thing is this happen only once in a while to a customer on Windows. I cant reproduce it.
I mean that plugin calls call REALYieldToRB on threads to give time to other threads, But Xojo calls events like DataAvailable in TCPSocket in that case on a thread instead of main thread. Now if that happens and you access window, you have problem.