In a few places in my app I want to save some data a few seconds after the user has entered it — like autosave — so I have code in the TextChange event like this:
//Cancel any pending save Timer.CancelCall(WeakAddressOf SaveRecord) //Perform a save 5 seconds from now Timer.CallLater(5000, WeakAddressOf SaveRecord)
I also use the same Timer.CancelCall line to cancel any pending save in the Close event of my view.
That works fine except that every now and then a user gets a NilObjectException error in Delegate.IM_Invoke which is called immediately after Xojo.Core._CallLaterTimer.Event_Action (based on the call stack that I log when I get an unhandled exception).
Am I doing something wrong that causes the NilObjectException to occur? Is there any way to test for/handle this?