Esempio n. 1
0
void
rbgobj_instance_unref(gpointer instance)
{
    GType type;

    type = G_TYPE_FROM_INSTANCE(instance);
    if (!rbgobj_convert_unref(type, instance)) {
        type = G_TYPE_FUNDAMENTAL(type);
        switch (type) {
          case G_TYPE_OBJECT:
            g_object_unref(instance);
            break;
          default:
            rbgobj_convert_unref(type, instance);
            break;
        }
    }
}
Esempio n. 2
0
VALUE
rbgobj_ruby_object_from_instance_with_unref(gpointer instance)
{
    VALUE result = rbgobj_ruby_object_from_instance(instance);
    if (!NIL_P(result)) {
        GType type;

        type = G_TYPE_FROM_INSTANCE(instance);
        if (!rbgobj_convert_unref(type, instance)) {
            type = G_TYPE_FUNDAMENTAL(type);
            switch (type) {
              case G_TYPE_OBJECT:
                g_object_unref(instance);
                break;
              default:
                rbgobj_convert_unref(type, instance);
                break;
            }
        }
    }
    return result;
}