I’ve been asked to bring forward an old tool set (RB 5.5 era) to modern OS X and Linux. There are a plethora of instances where I did naughty things from within threads back then.
Is there a way to locate these instances short of running the project over and over to catch each TAUIE? I’ve tried to add an Unhanded Exception handler at the app level, but that doesn’t seem to allow things to continue even though I return True in the even if a TAUIE.
Thanks, guys. What I’m trying to overcome is the fact that I tend to write callbacks for common items and then call them form the threads as well as the main loop code. This results in instances where the code may never be called within a thread, or it may be called multiple times in a thread loop.
It’s a real PITA to have to examine any assignment in such a large app to refactor any control.text = string or the like to set a variable and then kick off a timer.
That looks like it will end up doing the same thing as run - TAUIE - edit - run - next_TAUIE - edit - run … that I’m doing now. The difference being that the IDE at least takes me to the location in my code :).
depending on how complex your UI update from the thread was you might be able to get away with just adding a property to the thread that is a timer that gets set created and has its action handled via add handler to a private method added to the thread
move the ui update code in there and have the timer be started as part of starting to run the thread and set some period for it to do ui updates
since its part of the thread any properties of the thread are accessible to it
and the ui updates are always done on the main thread
Thanks for this as it will be a quicker refactor than rewriting so many methods. I may follow up with you on this when we get back home later this week.
[quote=306635:@Tim Jones]Hi Sam,
Thanks, but since I already sub-class threads for my purposes, I’m not sure what I’ve missed there. What else might I be missing?[/quote]
hmm… Not a very well thought through suggestion perhaps…
When you perform a UI update; what kind of code do use? Can you include a snippet?
Yeah, sorry… my bad… Hopefully Tim can post some code and I can redeem myself??
Right at the moment, I’m refactoring code into master/worker apps as even with a thread there’s an API I use that hogs the primary thread until it’s completed…