aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOsma Ahvenlampi <oa@iki.fi>2003-05-06 06:37:30 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-06 06:37:30 +0800
commit9902a5b9f55a904589bc7651722445d1bde3a2ef (patch)
treed5ade23b28e1d32d9e66353ca9cd5a738552c69f /src
parentbf389ed5fefee7aeffcf0b44c050fea7a19780bc (diff)
downloadgsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar.gz
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar.bz2
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar.lz
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar.xz
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.tar.zst
gsoc2013-epiphany-9902a5b9f55a904589bc7651722445d1bde3a2ef.zip
Fix memory leak while saving bookmarks, and performance problem during
2003-05-04 Osma Ahvenlampi <oa@iki.fi> * src/bookmarks/ephy-bookmarks.c: * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-bookmarks-import.c: * src/bookmarks/ephy-new-bookmark.c: Fix memory leak while saving bookmarks, and performance problem during import.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c4
-rw-r--r--src/bookmarks/ephy-bookmarks.c6
-rw-r--r--src/bookmarks/ephy-bookmarks.h2
-rw-r--r--src/bookmarks/ephy-new-bookmark.c2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index ebcc1a0e2..e767ad879 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -239,6 +239,8 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
g_free (keyword);
xmlFreeDoc (doc);
+ ephy_bookmarks_save (bookmarks);
+
return TRUE;
}
@@ -261,5 +263,7 @@ ephy_bookmarks_import_xbel (EphyBookmarks *bookmarks,
xmlFreeDoc (doc);
+ ephy_bookmarks_save (bookmarks);
+
return TRUE;
}
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 91c3e9c24..f8eb28469 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -247,6 +247,8 @@ ephy_bookmarks_init_defaults (EphyBookmarks *eb)
id = ephy_bookmarks_get_bookmark_id (eb, default_bookmarks[i].location);
ephy_toolbars_model_add_bookmark (model, FALSE, id);
}
+
+ ephy_bookmarks_save (eb);
}
static gboolean
@@ -280,7 +282,7 @@ ephy_bookmarks_load (EphyBookmarks *eb)
return TRUE;
}
-static void
+void
ephy_bookmarks_save (EphyBookmarks *eb)
{
xmlDocPtr doc;
@@ -326,6 +328,7 @@ ephy_bookmarks_save (EphyBookmarks *eb)
ephy_node_thaw (eb->priv->bookmarks);
xmlSaveFormatFile (eb->priv->xml_file, doc, 1);
+ xmlFreeDoc(doc);
}
static double
@@ -721,7 +724,6 @@ ephy_bookmarks_add (EphyBookmarks *eb,
ephy_node_add_child (eb->priv->notcategorized, bm);
ephy_bookmarks_emit_data_changed (eb);
- ephy_bookmarks_save (eb);
return bm;
}
diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h
index 0ab70af8e..162937c61 100644
--- a/src/bookmarks/ephy-bookmarks.h
+++ b/src/bookmarks/ephy-bookmarks.h
@@ -69,6 +69,8 @@ EphyBookmarks *ephy_bookmarks_new (void);
/* Bookmarks */
+void ephy_bookmarks_save (EphyBookmarks *eb);
+
EphyNode *ephy_bookmarks_add (EphyBookmarks *eb,
const char *title,
const char *url,
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c
index 6394a308f..ec913b112 100644
--- a/src/bookmarks/ephy-new-bookmark.c
+++ b/src/bookmarks/ephy-new-bookmark.c
@@ -174,6 +174,8 @@ ephy_new_bookmark_add (EphyNewBookmark *new_bookmark)
new_bookmark->priv->location,
new_bookmark->priv->icon);
}
+
+ ephy_bookmarks_save (new_bookmark->priv->bookmarks);
}
static void