Skip to content

Commit fcb6503

Browse files
authored
Clarify detachKey behavior in Finalizers
Closes #2015
1 parent fec8409 commit fcb6503

File tree

1 file changed

+12
-11
lines changed
  • accepted/future-releases/1847 - FinalizationRegistry

1 file changed

+12
-11
lines changed

accepted/future-releases/1847 - FinalizationRegistry/proposal.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ abstract class Finalizer<T> {
195195
/// for registrations which have been detached since they were attached.
196196
void attach(Object value, T token, {Object? detachKey});
197197
198-
/// Detaches the finalizer from any objects that used [detachKey] when
199-
/// attaching the finalizer to them.
198+
/// Detaches this finalizer from any objects that used the identical [detachKey] when
199+
/// attaching this finalizer to them.
200200
///
201-
/// If the finalizer was attached multiple times to the same object with different
201+
/// If this finalizer was attached multiple times to the same object with different
202202
/// detachment keys, only those attachments which used [detachKey] are
203203
/// removed.
204204
///
@@ -248,8 +248,8 @@ abstract class Finalizable {
248248
factory Finalizable._() => throw UnsupportedError("");
249249
}
250250
251-
typedef NativeFinalizer = Void Function(Pointer<Void>);
252-
typedef NativeFinalizerPtr = Pointer<NativeFunction<NativeFinalizer>>
251+
typedef NativeFinalizerSignature = Void Function(Pointer<Void> token);
252+
typedef NativeFinalizerPtr = Pointer<NativeFunction<NativeFinalizerSignature>>;
253253
254254
/// A native finalizer which can be attached to Dart objects.
255255
///
@@ -301,14 +301,15 @@ abstract class NativeFinalizer {
301301
/// [externalSize] is an amount of native (non-Dart) memory owned by the
302302
/// given [value]. This information is used to drive garbage collection
303303
/// scheduling heuristics.
304-
void attach(Finalizable value, Pointer<Void> token, {Object? detachKey, int externalSize}});
304+
void attach(Finalizable value, Pointer<Void> token,
305+
{Object? detachKey, int externalSize});
305306
306-
/// Detaches the finalizer from any objects that used [detachKey] when
307-
/// attaching the finalizer to them.
307+
/// Detaches this finalizer from any objects that used the identical
308+
/// [detachKey] when attaching this finalizer to them.
308309
///
309-
/// If the finalizer was attached multiple times to the same object with different
310-
/// detachment keys, only those attachments which used [detachKey] are
311-
/// removed.
310+
/// If this finalizer was attached multiple times to the same object with
311+
/// different detachment keys, only those attachments which used [detachKey]
312+
/// are removed.
312313
///
313314
/// After detaching, an attachment won't cause any callbacks to happen if the
314315
/// object become inaccessible.

0 commit comments

Comments
 (0)