mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
2001-05-19 Dave Peticolas <dave@krondo.com>
* src/engine/sixtp.c (gnc_is_our_xml_file): fix mem leak * src/engine/io-gncxml-v2.c (gnc_book_load_from_xml_file_v2): fix mem leak * src/gnome/window-acct-tree.c: fix mem leak * src/doc/design/engine.texinfo: update docs * src/gnome/window-acct-tree.c: fix mem leaks * src/engine/io-gncxml-v2.c (gnc_counter_end_handler): fix mem leak * src/engine/gnc-account-xml-v2.c (account_parent_handler): fix mem leak * src/engine/Group.c (xaccFreeAccountGroup): set parent's child pointer to NULL (xaccAccountRemoveGroup): set parent's child pointer to NULL * src/engine/sixtp-dom-parsers.c (dom_tree_to_integer): fix mem leak git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4243 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
25bf6dbb5e
commit
8b12396e48
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2001-05-19 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/sixtp.c (gnc_is_our_xml_file): fix mem leak
|
||||
|
||||
* src/engine/io-gncxml-v2.c (gnc_book_load_from_xml_file_v2): fix
|
||||
mem leak
|
||||
|
||||
* src/gnome/window-acct-tree.c: fix mem leak
|
||||
|
||||
* src/doc/design/engine.texinfo: update docs
|
||||
|
||||
* src/gnome/window-acct-tree.c: fix mem leaks
|
||||
|
||||
* src/engine/io-gncxml-v2.c (gnc_counter_end_handler): fix mem
|
||||
leak
|
||||
|
||||
* src/engine/gnc-account-xml-v2.c (account_parent_handler): fix
|
||||
mem leak
|
||||
|
||||
* src/engine/Group.c (xaccFreeAccountGroup): set parent's child
|
||||
pointer to NULL
|
||||
(xaccAccountRemoveGroup): set parent's child pointer to NULL
|
||||
|
||||
* src/engine/sixtp-dom-parsers.c (dom_tree_to_integer): fix mem leak
|
||||
|
||||
2001-05-18 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/io-gncxml-w.c: remove
|
||||
|
@ -2095,6 +2095,27 @@ Accounts, Splits, and Transactions.
|
||||
|
||||
Account Groups do not have key-value frames or GUIDs.
|
||||
|
||||
@menu
|
||||
* General Account Group API::
|
||||
@end menu
|
||||
|
||||
@node General Account Group API, , Account Groups, Account Groups
|
||||
@subsection General Account Group API
|
||||
|
||||
@deftypefun {AccountGroup *} xaccMallocAccountGroup (void)
|
||||
Return a newly-allocated & initialized Account Group.
|
||||
The Group must be freed with @code{xaccFreeAccountGroup}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void xaccFreeAccountGroup (AccountGroup * @var{account_group})
|
||||
Free the given Group and all its resources, including the Accounts.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void xaccAccountGroupCommitEdit (AccountGroup * @var{grp})
|
||||
Recursively call @code{xaccAccountCommitEdit} on all child accounts
|
||||
and their children.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node GNCBooks, Scrub, Account Groups, Engine
|
||||
@section GNCBooks
|
||||
|
@ -209,6 +209,8 @@ xaccFreeAccountGroup (AccountGroup *grp)
|
||||
if (!root_grp) return;
|
||||
}
|
||||
|
||||
if (grp->parent) grp->parent->children = NULL;
|
||||
|
||||
grp->parent = NULL;
|
||||
grp->balance = gnc_numeric_zero();
|
||||
g_free (grp);
|
||||
@ -536,7 +538,8 @@ xaccAccountRemoveGroup (Account *acc)
|
||||
if (!acc) return;
|
||||
|
||||
grp = acc->children;
|
||||
|
||||
|
||||
if (grp) grp->parent = NULL;
|
||||
acc->children = NULL;
|
||||
|
||||
/* make sure that the parent of the group is marked
|
||||
|
@ -225,17 +225,22 @@ static gboolean
|
||||
account_parent_handler (xmlNodePtr node, gpointer act)
|
||||
{
|
||||
Account *parent;
|
||||
GUID *gid = dom_tree_to_guid(node);
|
||||
GUID *gid;
|
||||
|
||||
gid = dom_tree_to_guid(node);
|
||||
g_return_val_if_fail(gid, FALSE);
|
||||
|
||||
parent = xaccAccountLookup(gid);
|
||||
|
||||
g_return_val_if_fail(parent, FALSE);
|
||||
|
||||
parent = xaccAccountLookup(gid);
|
||||
if (!parent)
|
||||
{
|
||||
g_free (gid);
|
||||
g_return_val_if_fail(parent, FALSE);
|
||||
}
|
||||
|
||||
xaccAccountInsertSubAccount(parent, (Account*)act);
|
||||
|
||||
/* xaccGUIDFree(gid); */
|
||||
g_free (gid);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,12 @@ gnc_counter_end_handler(gpointer data_for_children,
|
||||
{
|
||||
g_warning("string_to_integer failed with input: %s",
|
||||
strval ? strval : "(null)");
|
||||
g_free (strval);
|
||||
xmlFree (type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_free (strval);
|
||||
|
||||
if(safe_strcmp(type, "transaction") == 0)
|
||||
{
|
||||
sixdata->counter.transactions_total = val;
|
||||
@ -189,9 +192,13 @@ gnc_counter_end_handler(gpointer data_for_children,
|
||||
{
|
||||
g_warning("Unknown type: %s",
|
||||
type ? type : "(null)");
|
||||
xmlFree (type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xmlFree (type);
|
||||
xmlFreeNode(tree);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -330,6 +337,9 @@ gnc_book_load_from_xml_file_v2(
|
||||
/* set up various state that is not normally stored in the byte stream */
|
||||
xaccRecomputeGroupBalance (gnc_book_get_group(book));
|
||||
|
||||
/* destroy the parser */
|
||||
sixtp_destroy (top_parser);
|
||||
|
||||
/* start logging again */
|
||||
xaccLogEnable ();
|
||||
|
||||
|
@ -95,17 +95,15 @@ gboolean
|
||||
dom_tree_to_integer(xmlNodePtr node, gint64 *daint)
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
gboolean ret;
|
||||
|
||||
text = dom_tree_to_text(node);
|
||||
|
||||
if(string_to_gint64(text, daint))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
ret = string_to_gint64(text, daint);
|
||||
|
||||
g_free (text);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
kvp_value*
|
||||
@ -306,12 +304,18 @@ struct kvp_val_converter val_converters[] = {
|
||||
kvp_value*
|
||||
dom_tree_to_kvp_value(xmlNodePtr node)
|
||||
{
|
||||
xmlChar *xml_type;
|
||||
gchar *type;
|
||||
struct kvp_val_converter *mark;
|
||||
kvp_value *ret = NULL;
|
||||
|
||||
type = xmlGetProp(node, "type");
|
||||
if(!type)
|
||||
|
||||
xml_type = xmlGetProp(node, "type");
|
||||
if(xml_type)
|
||||
{
|
||||
type = g_strdup (xml_type);
|
||||
xmlFree (xml_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = g_strdup_printf("string");
|
||||
}
|
||||
|
@ -751,7 +751,6 @@ gnc_is_our_xml_file(const char *filename, const char *first_tag)
|
||||
char first_chunk[256];
|
||||
char* cursor = NULL;
|
||||
ssize_t num_read;
|
||||
char *tag_compare;
|
||||
|
||||
g_return_val_if_fail(filename, FALSE);
|
||||
g_return_val_if_fail(first_tag, FALSE);
|
||||
@ -760,8 +759,6 @@ gnc_is_our_xml_file(const char *filename, const char *first_tag)
|
||||
if (f == NULL)
|
||||
return FALSE;
|
||||
|
||||
tag_compare = g_strdup_printf("<%s>", first_tag);
|
||||
|
||||
num_read = fread(first_chunk, sizeof(char), sizeof(first_chunk) - 1, f);
|
||||
fclose(f);
|
||||
|
||||
@ -781,6 +778,9 @@ gnc_is_our_xml_file(const char *filename, const char *first_tag)
|
||||
|
||||
if(strncmp(cursor, "<?xml", 5) == 0)
|
||||
{
|
||||
char *tag_compare;
|
||||
gboolean result;
|
||||
|
||||
if(!search_for('>', &cursor))
|
||||
{
|
||||
return FALSE;
|
||||
@ -791,18 +791,16 @@ gnc_is_our_xml_file(const char *filename, const char *first_tag)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(strncmp(cursor, tag_compare, strlen(tag_compare)) == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
tag_compare = g_strdup_printf("<%s>", first_tag);
|
||||
|
||||
result = (strncmp(cursor, tag_compare, strlen(tag_compare)) == 0);
|
||||
g_free (tag_compare);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -126,6 +126,9 @@ gnc_acct_tree_view_labeler(GnomeMDIChild * child, GtkWidget * current,
|
||||
gtk_label_set_text(GTK_LABEL(current), name);
|
||||
}
|
||||
gtk_label_set_justify(GTK_LABEL(current), GTK_JUSTIFY_LEFT);
|
||||
|
||||
if (name) free (name);
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
@ -154,7 +157,8 @@ gnc_acct_tree_view_new(GnomeMDIChild * child, gpointer user_data) {
|
||||
GNCMainInfo * maininfo = user_data;
|
||||
GNCMainChildInfo * mc = g_new0(GNCMainChildInfo, 1);
|
||||
GNCAcctTreeWin * win = gnc_acct_tree_window_new(child->name);
|
||||
|
||||
char * name;
|
||||
|
||||
mc->contents = gnc_acct_tree_window_get_widget(win);
|
||||
mc->child = child;
|
||||
mc->app = NULL;
|
||||
@ -166,10 +170,10 @@ gnc_acct_tree_view_new(GnomeMDIChild * child, gpointer user_data) {
|
||||
|
||||
gtk_object_set_user_data(GTK_OBJECT(child), mc);
|
||||
|
||||
/* set the child name that will get used to save app state */
|
||||
gnome_mdi_child_set_name(mc->child,
|
||||
g_strdup_printf("gnc-acct-tree:id=%d",
|
||||
win->options_id));
|
||||
/* set the child name that will get used to save app state */
|
||||
name = g_strdup_printf("gnc-acct-tree:id=%d", win->options_id);
|
||||
gnome_mdi_child_set_name(mc->child, name);
|
||||
g_free (name);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(child), "destroy",
|
||||
gnc_acct_tree_view_destroy, mc);
|
||||
@ -974,8 +978,6 @@ gnc_acct_tree_window_new(const gchar * url) {
|
||||
SCM temp;
|
||||
int options_id;
|
||||
URLType type;
|
||||
char * location;
|
||||
char * label;
|
||||
|
||||
treewin->euro_change_callback_id =
|
||||
gnc_register_option_change_callback(gnc_euro_change, treewin,
|
||||
@ -991,6 +993,9 @@ gnc_acct_tree_window_new(const gchar * url) {
|
||||
gnc_acct_tree_window_options_new(treewin);
|
||||
}
|
||||
else {
|
||||
char * location = NULL;
|
||||
char * label = NULL;
|
||||
|
||||
/* if an URL is specified, it should look like
|
||||
* gnc-acct-tree:id=17 . We want to get the number out,
|
||||
* then look up the options in the global DB. */
|
||||
@ -1014,8 +1019,11 @@ gnc_acct_tree_window_new(const gchar * url) {
|
||||
else {
|
||||
gnc_acct_tree_window_options_new(treewin);
|
||||
}
|
||||
|
||||
g_free (location);
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
|
||||
treewin->odb = gnc_option_db_new(treewin->options);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(treewin->account_tree), "activate_account",
|
||||
|
Loading…
Reference in New Issue
Block a user