mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Get "make check" to work with the gobjectified objects.
- fix a bunch of tests to use the new gobject defs - make sure we initialize g_type_init() in qof_init() - fix qofbook's destruction sequence (I broke it earlier) - use dispose() in QofInstance - use qof_init() for the business tests. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gobject-engine-dev-warlord@15826 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -110,6 +110,8 @@ qof_book_finalize_real (GObject *bookp)
|
||||
void
|
||||
qof_book_destroy (QofBook *book)
|
||||
{
|
||||
GHashTable* cols;
|
||||
|
||||
if (!book) return;
|
||||
ENTER ("book=%p", book);
|
||||
|
||||
@@ -130,10 +132,16 @@ qof_book_destroy (QofBook *book)
|
||||
|
||||
/* qof_instance_release (&book->inst); */
|
||||
|
||||
g_hash_table_destroy (book->hash_of_collections);
|
||||
/* Note: we need to save this hashtable until after we remove ourself
|
||||
* from it, otherwise we'll crash in our dispose() function when we
|
||||
* DO remove ourself from the collection but the collection had already
|
||||
* been destroyed.
|
||||
*/
|
||||
cols = book->hash_of_collections;
|
||||
g_object_unref (book);
|
||||
g_hash_table_destroy (cols);
|
||||
book->hash_of_collections = NULL;
|
||||
|
||||
g_object_unref (book);
|
||||
LEAVE ("book=%p", book);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,16 @@ static QofLogModule log_module = QOF_MOD_ENGINE;
|
||||
|
||||
/* ========================================================== */
|
||||
|
||||
QOF_GOBJECT_IMPL(qof_instance, QofInstance, G_TYPE_OBJECT);
|
||||
QOF_GOBJECT_GET_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT, {});
|
||||
QOF_GOBJECT_FINALIZE(qof_instance);
|
||||
|
||||
static void qof_instance_dispose(GObject*);
|
||||
static void qof_instance_class_init(QofInstanceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
object_class->finalize = qof_instance_finalize;
|
||||
object_class->dispose = qof_instance_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
qof_instance_init (QofInstance *inst)
|
||||
@@ -66,6 +75,14 @@ qof_instance_init_data (QofInstance *inst, QofIdType type, QofBook *book)
|
||||
qof_entity_init (inst, type, col);
|
||||
}
|
||||
|
||||
static void
|
||||
qof_instance_dispose (GObject *instp)
|
||||
{
|
||||
QofInstance* inst = QOF_INSTANCE(instp);
|
||||
qof_entity_release (inst);
|
||||
G_OBJECT_CLASS(qof_instance_parent_class)->dispose(instp);
|
||||
}
|
||||
|
||||
static void
|
||||
qof_instance_finalize_real (GObject *instp)
|
||||
{
|
||||
@@ -76,7 +93,6 @@ qof_instance_finalize_real (GObject *instp)
|
||||
inst->editlevel = 0;
|
||||
inst->do_free = FALSE;
|
||||
inst->dirty = FALSE;
|
||||
qof_entity_release (inst);
|
||||
}
|
||||
|
||||
const GUID *
|
||||
|
||||
@@ -545,7 +545,8 @@ qof_util_param_as_string(QofInstance *ent, QofParam *param)
|
||||
void
|
||||
qof_init (void)
|
||||
{
|
||||
qof_log_init();
|
||||
g_type_init();
|
||||
qof_log_init();
|
||||
qof_util_get_string_cache ();
|
||||
guid_init ();
|
||||
qof_object_initialize ();
|
||||
|
||||
Reference in New Issue
Block a user