3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-26 00:00:55 +01:00

Fix thread-unsafe command unregistration (#583)

Access to the dispatcher is guarded by `lock`.
Dieser Commit ist enthalten in:
Hugo Manrique 2021-10-04 21:17:36 +02:00 committet von GitHub
Ursprung aa210b3544
Commit 567582b2e2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -143,9 +143,14 @@ public class VelocityCommandManager implements CommandManager {
@Override @Override
public void unregister(final String alias) { public void unregister(final String alias) {
Preconditions.checkNotNull(alias, "alias"); Preconditions.checkNotNull(alias, "alias");
// The literals of secondary aliases will preserve the children of lock.writeLock().lock();
// the removed literal in the graph. try {
dispatcher.getRoot().removeChildByName(alias.toLowerCase(Locale.ENGLISH)); // The literals of secondary aliases will preserve the children of
// the removed literal in the graph.
dispatcher.getRoot().removeChildByName(alias.toLowerCase(Locale.ENGLISH));
} finally {
lock.writeLock().unlock();
}
} }
/** /**