Skip to content

Commit 1d6d39e

Browse files
committed
Add a comment about runAndWait
1 parent f6c8756 commit 1d6d39e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ui/src/main/java/edu/wpi/grip/ui/pipeline/PipelineController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ private ConnectionView findConnectionView(Connection connection) {
179179
* details of adding the connection.
180180
*/
181181
private void addConnectionView(Connection connection) {
182+
// runAndWait() is used here because we don't want the main thread to resume, possibly causing more actions
183+
// that manipulate the list of connections, until the GUI component is added. This prevents rendering issues.
184+
// Since the code in here JUST manipulates JavaFX components and doesn't post stuff to the EventBus, it's safe
185+
// to put in runAndWait() without fear of deadlock.
182186
PlatformImpl.runAndWait(() -> {
183187
// Before adding a connection control, we have to look up the controls for both sockets in the connection so
184188
// we know where to position it.

0 commit comments

Comments
 (0)