Exemple #1
0
static void
rclosure_weak_notify(gpointer data, GObject* where_the_object_was)
{
    GRClosure *rclosure = data;
    if (rclosure_alive_p(rclosure)) {
        rclosure->objects =
            g_list_remove(rclosure->objects, where_the_object_was);
        rclosure_unref(rclosure);
    }
}
static void
gr_closure_holder_free(GRClosure *rclosure)
{
    if (rclosure->count > 0) {
        rclosure->count = 1;

        /* No need to remove us from the relatives hash of our objects, as
         * those aren't alive anymore anyway */
        rclosure_unref(rclosure);
    }
}
Exemple #3
0
static void
rclosure_invalidate(G_GNUC_UNUSED gpointer data, GClosure *closure)
{
    GRClosure *rclosure = (GRClosure*)closure;

    if (rclosure->count > 0) {
        GList *next;

        rclosure->count = 1;
        for (next = rclosure->objects; next; next = next->next) {
            GObject *object = G_OBJECT(next->data);
            VALUE obj = rbgobj_ruby_object_from_instance2(object, FALSE);
            if (!NIL_P(rclosure->rb_holder) && !NIL_P(obj))
                G_REMOVE_RELATIVE(obj, id_closures, rclosure->rb_holder);
        }

        rclosure_unref(rclosure);
    }
}