Skip to content
  • Colin Walters's avatar
    Fix assertions during context dispose · be5c12c4
    Colin Walters authored
    The current toggle ref code has and assertion that we don't have a
    DOWN notification pending while the object is supposed to be live -
    and during normal operation, this is true.
    
    Except at context shutdown, we force the JS object to be destroyed,
    which can cause recursion into a dispose handler of a gobject, which
    can then queue a toggle down.  Then we later force dispose that
    object, and find the DOWN pending.
    
    Now, we could simply avoid all of this insanity by default and allow
    the kernel to clean up our state much faster, in a more power
    efficient way by simply not doing any of this...
    
    However, there are valid use cases for wanting "clean" exits, such as
    valgrind.  So this patch fixes things up for the dispose by iterating
    over the entire live object list before we drop into the JS context
    destruction, breaking the JS <-> C association.  This safely clears
    the toggle refs, so the JS side is just JS cleanup, we don't reenter
    GObject land.
    
    This will make several of...
    be5c12c4