Changeset 26412


Ignore:
Timestamp:
06/21/10 13:44:05 (7 years ago)
Author:
piotras
Message:

midgard_collector_new: check if given classname is registsred in GType system and if it's MidgardDBObject derived one. Fix #1684

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ragnaroek/midgard/core/midgard/src/midgard_collector.c

    r26204 r26412  
    105105        g_assert(domain);
    106106        g_assert(value);
     107
     108        GType type = g_type_from_name (typename);
     109        if (!type) {
     110                g_warning ("Class %s is not registered in GType system", typename);
     111                return NULL;
     112        }
     113
     114        GObjectClass *dbklass = G_OBJECT_CLASS (g_type_class_peek (type));
     115        if (!dbklass) {
     116                g_warning ("Can not find %s class", typename);
     117                return NULL;
     118        }
     119
     120        if (!MIDGARD_IS_DBOBJECT_CLASS (dbklass)) {
     121                g_warning ("Given '%s' classname is not MidgardDBObject derived class", typename);
     122                return NULL;
     123        }
    107124
    108125        MidgardCollector *self =
Note: See TracChangeset for help on using the changeset viewer.