[wpilib] Make Preferences Listener not depend on mutable fields (#8607)

The Listener installed by Preferences was referencing m_typePublisher which could be modified by a future call to setNetworkTableInstance(). Instead, reference a local.

Also made Topic.m_handle final, to guarantee that Topic.equals() is thread-safe, and still work after the publisher has been closed.
This commit is contained in:
Kevin Cooney
2026-02-27 12:42:40 -08:00
committed by GitHub
parent e311722637
commit 613bd88548
2 changed files with 6 additions and 4 deletions

View File

@@ -330,8 +330,8 @@ public class Topic {
}
/** NetworkTables instance. */
protected NetworkTableInstance m_inst;
protected final NetworkTableInstance m_inst;
/** NetworkTables handle. */
protected int m_handle;
protected final int m_handle;
}