Although my issue of a thread getting a threadaccessingUI exception when the thread terminated is solvable by keeping the window which created the thread open until the thread has terminated, I’d like to understand better why it happens. The thread is instantiated thus:
importThread = new taskClass ()
AddHandler importThread.run, WeakAddressOf importWrapper
AddHandler importThread.UIupdater, WeakAddressOf app.UIupdater
importThread.run ()
and importThread
is a property of the window. The thread makes use of some properties of the window, and importWrapper
is a method of the window.
Is the exception happening because the thread uses some window properties or because it uses a window method?
If I move both the method and the properties away from the window, can I dissociate the window from the thread, such that the window can be closed once the thread is safely running? From the user’s PoV this would be preferable.