I had been using a similar technique in Delphi since before I found out about the [WayBack] TRecall class and thought: I think my TTemporaryCursor is smarter, as it is based on interfaces.
My [WayBack] TTemporaryCursor (now [WayBack] at bitbucket) class only stores an integer, so it cannot derive from TRecall. Besides it is based on IInterface which got introduced in Delphi 6, but was present as IUnknown since Delphi 3 (see [WayBack] Interface It! A quick guide to the ins and outs of interfaces in Delphi. By Jimmy Tharpe).
This means that TRecall could have been based on IInterface, so I wonder why it was not.
Note I’m not the first to publish about such a class (Malcolm Grooves wrote [WayBack] TCursorSnapshot, SwissDelphiCenter has [WayBack] TMyCursor, Nick Hodges published about [WayBack] TAutoCursor), it’s just that it has been in my tool box for so long, and written memento classes that you will see 2 articles on it this week.
In the mean time (this works with Delphi 2009 and up), I also wrote a small class that does similar things for any [WayBack] anonymous method. More on that tomorrow.
Like any syntax highlighter, it is not perfect (only a Delphi compiler driven highlighter would have a chance to be perfect), but it does a pretty good job and gets better over time.
Talking about Danny Thorpe: he also posted a nice hint on threading methods for ancient Delphi versions that equally applies to DLL exports in any Delphi version, even any programming environment.
Recently, I had to do some surgery in such a Pre-Delphi 6 application, and I was really happy to remember thisanswer: it instantly solved some process crashes, and the added logging allowed for investigating the actual cause.
Note that this tip isn’t just a good advice for old Delphi versions.
Even in younger Delphi versions, you have to watch methods that can be called from outside a regular Delphi context, for instance exported methods.
Heck, it applies to virtually any development environment: exceptions usually are very specific to that environment and should never cross a process boundary.
Summary
Take the approach below
for Execute methods in your own thread classes in Delphi 5 or earlier
Once every while, one of your StackOverflow answers gets an edit suggestion that is really valuable.
This case it was Edwin Yip who suggested to emphasize the difference between TStringBuilder and TStringList (adding characters versus lines).
Too bad that freshly 10k user Makoto showed he hates bold emphasis, intentional property casing and post signatures by removing the added value (there is so much emphasis he could remove on other answers to warrant at least a day time job).
I needed to modify some code that had been amended from the Delphi TParser class (which parses DFM files, but can be amended to other sources as well), so here are some links I found during my research:
Be sure to watch the presenter Stefan Eggermont (StackOverflow, Twitter, LinkedIn, GitHub, FOSDEM, website www.legacycode.nl) as this kind of analysis (that is also possible for other languages and tools) can highly speedup your work.