Skip to content
  • Philip Chimento's avatar
    object: Warn about finalized GObject in fewer cases · 8cdd6291
    Philip Chimento authored
    We want to remove this warning in cases where the subsequent code isn't
    actually trying to access the underlying GObject and therefore isn't
    going to crash. On resolve() we don't want the warning, as that only
    applies to prototype objects. On trace() we don't want it either, as that
    may legitimately be called during the GC mark phase on a JS wrapper with
    a disposed GObject.
    
    In the typecheck function, we only use the GObject for a debug assertion.
    All the other checks use the GType. We relax the assertion and only do
    the debug sanity check if the GObject is still alive. Instead of logging
    the warning here, we log the warning in gjs_g_object_from_object() which
    happens later when the GObject is actually used.
    
    We keep the warnings in property getters and setters, since those would
    access the underlying GObject, and they are now only called for names
    that really do resolve to GObject properties and fields.
    
    Closes: #24
    8cdd6291