3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 23:30:26 +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
public void unregister(final String alias) {
Preconditions.checkNotNull(alias, "alias");
// The literals of secondary aliases will preserve the children of
// the removed literal in the graph.
dispatcher.getRoot().removeChildByName(alias.toLowerCase(Locale.ENGLISH));
lock.writeLock().lock();
try {
// 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();
}
}
/**