Skip to content
  • Marius Gerbershagen's avatar
    gc: call finalizer for builtin object only when the object is truly unreachable · ddb7bb72
    Marius Gerbershagen authored
    
    
    Otherwise it can happen that a user-defined finalizer for some object
    A storing a builtin object B registers another finalizer for A making
    B reachable again while B has already been finalized.
    
    We can't impose an ordering for user-defined finalizers in general
    since these may include cyclic references. Therefore it is the duty of
    the user to write the finalizers in a consistent way which is
    independent of the order in which the finalizers are called. This
    doesn't work for builtin objects since the user can't influence
    the finalizers in this case.
    
    We also fix a bug which lead to the removal of the standard finalizer
    if a user-defined finalizer was registered and then removed.
    
    Co-authored-by: default avatarDaniel Kochmański <daniel@turtleware.eu>
    ddb7bb72