Skip to content
  • Georges Basile Stavracas Neto's avatar
    object: Only weak unref if GObject is still alive · 8d50e2b4
    Georges Basile Stavracas Neto authored
    The function disassociate_js_gobject() is currently unconditionally
    removing the weak reference of the wrapped GObject. This is because
    we were previously assuming that there was always a toggle ref, and
    so we would never reach this code path after the wrapped GObject was
    destroyed.
    
    Turns out, with commit 0cc23474 it is now a regular case to call
    this function after the GObject is finalized. When that happens, it
    will reach wrapped_gobj_dispose_notify() and the wrapped GObject will
    be marked as finalized. disassociate_js_gobject(), however, will try
    to weak unref it, without checking if the GObject was finalized already.
    
    This commit fix that by simply checking if the wrapped GObject was
    finalized before trying to weak unref it.
    8d50e2b4