-
Bug
-
Resolution: Fixed
-
P2
-
None
-
repo-panama
When working with "untrusted" segments, the user might want to do this:
```
try (var handle = segment.scope().acquire()) {
// operate on segment safely
} // ok now segment can be closed
```
While this works to protect against deterministic deallocation, it fails to protect against implicit deallocation. So, if the segment becomes unreachable inside the TWR, its scope could still be closed (which might cause issue if e.g. the user has taken a long address out of the segment and operating on it).
For these reasons, it would be preferrable if a scope handle would also help in keeping the scope reachable.
```
try (var handle = segment.scope().acquire()) {
// operate on segment safely
} // ok now segment can be closed
```
While this works to protect against deterministic deallocation, it fails to protect against implicit deallocation. So, if the segment becomes unreachable inside the TWR, its scope could still be closed (which might cause issue if e.g. the user has taken a long address out of the segment and operating on it).
For these reasons, it would be preferrable if a scope handle would also help in keeping the scope reachable.