8279527: Dereferencing segments backed by different scopes leads to pollution

Reviewed-by: psandoz, jvernee
This commit is contained in:
Maurizio Cimadamore 2022-01-07 13:41:29 +00:00
parent 967ef0c482
commit d65c665839
8 changed files with 64 additions and 76 deletions

View file

@ -767,7 +767,11 @@ public abstract class Buffer {
final void checkScope() {
ScopedMemoryAccess.Scope scope = scope();
if (scope != null) {
scope.checkValidState();
try {
scope.checkValidState();
} catch (ScopedMemoryAccess.Scope.ScopedAccessError e) {
throw new IllegalStateException("This segment is already closed");
}
}
}