Why do I get the error “org.eclipse.swt.SWTException: Invalid thread access”?
In SWT, by definition the thread that creates the Display is a UI-thread. This thread is responsible for reading and dispatching events from the operating system event queue, and invoking listeners in response to these events. Listener code is executed in the UI-thread. This makes an SWT application generally quite responsive, behaving like most other operating system programs. However, any long operation, when executed by a listener, will run in the UI-thread and prevent it from reading and dispatching events, thus hanging the application. If a listener has a large amount of work to perform, instead of performing that work in the UI-thread, it can fork a separate thread so the UI-thread can continue dispatching events. If the other thread needs to execute code that accesses an SWT object, such as changing the string in a label, there is a concurrency issue. At the very least, some kind of synchronization is necessary to prevent the operating system or SWT from crashing, hanging or beh
Related Questions
- During installation of the device portion of the software I get error message stating that setup file is invalid and the cab file is not copied to the desktop. Can I fix it?
- When I try to retrieve data from the HSA I get an error message in the console about an invalid magic number for FITS file. What is going on?
- Why do I get the error "org.eclipse.swt.SWTException: Invalid thread access"?