-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When I pass a parent dispose scope to some class, that class can dispose the parent dispose scope I passed into it. I think this can be a source of bugs in larger codebases and should be addressed somehow.
Example:
class IOSDriver extends PlatformDriver {
IOSDriver(
DisposeScope parentDisposeScope,
) : _disposeScope = DisposeScope() {
_disposeScope.disposedBy(parentDisposeScope);
parentDisposeScope.dispose(); // I don't want to be able to do this!
}
final DisposeScope _disposeScope;
// more methods
}We could have some interface, e.g DisposeScopeRef (terrible name), that would have only the addDispose method. DisposeScope would implement DisposeScopeRef.
cc: @RobertOdrowaz
Metadata
Metadata
Assignees
Labels
No labels