Skip to content

Commit 104f792

Browse files
committed
Restore Preferences' NetworkTableInstance before calling aitForListenerQueue()
1 parent d5333f9 commit 104f792

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

testing/src/main/java/com/team2813/lib2813/testing/junit/jupiter/IsolatedNetworkTablesExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ private void restoreNetworkTableInstance(ExtensionContext context) {
6767
Store store = context.getStore(NAMESPACE);
6868
Data data = DATA_KEY.remove(store);
6969
if (data != null) {
70+
Preferences.setNetworkTableInstance(data.prevInstance);
71+
7072
// Clear out the listener queue before destroying our temporary NetworkTableInstance.
7173
//
7274
// This works around a race condition in WPILib where a listener registered by Preferences can
@@ -77,8 +79,6 @@ private void restoreNetworkTableInstance(ExtensionContext context) {
7779
"Timed out waiting for the NetworkTableInstance listener queue to empty (waited 500ms);"
7880
+ " JVM may crash");
7981
}
80-
81-
Preferences.setNetworkTableInstance(data.prevInstance);
8282
data.testInstance.close();
8383
}
8484
}

0 commit comments

Comments
 (0)