TL;DR: In this paper, a method and a device for synchronous and asynchronous operation executed by a graphical user interface (GUI) consisting of an event queue filter and an event dispatching thread is presented.
Abstract: The invention discloses a method and a device for synchronous and asynchronous operation executed by a graphical user interface. The method for synchronous and asynchronous operation executed by the graphical user interface comprises the following steps: an event queue filter receives events output by an event queue, wherein, the event queue filter is used for filtering the events; the event queue filter checks whether events are identical with the events received existing in a background event treatment thread pool, if the events are identical with the events received existing in the background event treatment thread pool, the identical events are filtered; the background event treatment thread pool is used for managing correlation relation between the events and an event treatment thread corresponding to the events; an event dispatching thread dispatches events from the event queue filter. Through the invention, the asynchronous operation effectively prevents the misoperation of a user.
TL;DR: A general technique to find invalid thread access errors in multithreaded GUI applications as a call graph reachability problem with thread spawning as the sources and GUI object accessing as the sinks is presented.
Abstract: To keep a Graphical User Interface (GUI) responsive and active, a GUI application often has a main UI thread (or event dispatching thread) and spawns separate threads to handle lengthy operations in the background, such as expensive computation, I/O tasks, and network requests. Many GUI frameworks require all GUI objects to be accessed exclusively by the UI thread. If a GUI object is accessed from a non-UI thread, an invalid thread access error occurs and the whole application may abort. This paper presents a general technique to find such invalid thread access errors in multithreaded GUI applications. We formulate finding invalid thread access errors as a call graph reachability problem with thread spawning as the sources and GUI object accessing as the sinks. Standard call graph construction algorithms fail to build a good call graph for some modern GUI applications, because of heavy use of reflection. Thus, our technique builds reflection-aware call graphs. We implemented our technique and instantiated it for four popular Java GUI frameworks: SWT, the Eclipse plugin framework, Swing, and Android. In an evaluation on 9 programs comprising 89273 LOC, our technique found 5 previously-known errors and 5 new ones.