From 365c12983f6ccecc7bd98fbf97047be655c9b8f9 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Tue, 10 Jun 2003 04:04:17 +0000 Subject: [PATCH] a few small fixes git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8528 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Group.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/engine/Group.c b/src/engine/Group.c index cf7844092c..a27d701c52 100644 --- a/src/engine/Group.c +++ b/src/engine/Group.c @@ -92,15 +92,11 @@ xaccGetAccountGroup (GNCBook *book) void xaccSetAccountGroup (GNCBook *book, AccountGroup *grp) { + AccountGroup *old_grp; if (!book) return; - /* XXX Do not free the old topgroup here unless you also fix - * all the other uses of gnc_book_set_group! That's because - * the account group is not reference-counted, and there's some - * chance that we'll leave a dangling pointer somewhere. - */ - - if (gnc_book_get_group (book) == grp) return; + old_grp = xaccGetAccountGroup (grp); + if (old_grp == grp) return; if (grp && grp->book != book) { @@ -109,6 +105,14 @@ xaccSetAccountGroup (GNCBook *book, AccountGroup *grp) } gnc_book_set_data (book, GNC_TOP_GROUP, grp); + + /* XXX Do not free the old topgroup here unless you also fix + * all the other uses of xaccSetAccountGroup()! That's because + * the account group is not reference-counted, and there's some + * chance that we'll leave a dangling pointer somewhere. + */ + + /* xaccAccountGroupDestroy (old_grp); */ } /********************************************************************\