goffice r2146 - in branches/goffice-0-6: . goffice/component goffice/graph
- From: jbrefort svn gnome org
- To: svn-commits-list gnome org
- Subject: goffice r2146 - in branches/goffice-0-6: . goffice/component goffice/graph
- Date: Sun, 13 Jul 2008 08:49:38 +0000 (UTC)
Author: jbrefort
Date: Sun Jul 13 08:49:38 2008
New Revision: 2146
URL: http://svn.gnome.org/viewvc/goffice?rev=2146&view=rev
Log:
2008-07-13 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-plot-engine.c:
(gog_plot_type_service_finalize),
(gog_trend_line_service_finalize),
(gog_trend_line_service_class_init): fix memory leaks. [#542506]
Modified:
branches/goffice-0-6/ChangeLog
branches/goffice-0-6/NEWS
branches/goffice-0-6/goffice/component/go-component-factory.c
branches/goffice-0-6/goffice/graph/gog-plot-engine.c
Modified: branches/goffice-0-6/NEWS
==============================================================================
--- branches/goffice-0-6/NEWS (original)
+++ branches/goffice-0-6/NEWS Sun Jul 13 08:49:38 2008
@@ -4,6 +4,7 @@
* New boxplot feature requested: exclude outliers. [#534642]
* Fixed plot types activation/deactivation issues.
* Always use full lines when drawing markers. [#536276]
+ * Fix plot engines memory leaks. [#542506]
Morten:
* Work around valgrind bug.
Modified: branches/goffice-0-6/goffice/component/go-component-factory.c
==============================================================================
--- branches/goffice-0-6/goffice/component/go-component-factory.c (original)
+++ branches/goffice-0-6/goffice/component/go-component-factory.c Sun Jul 13 08:49:38 2008
@@ -121,8 +121,7 @@
(GDestroyNotify)
go_mime_type_free);
for (ptr = tree->xmlChildrenNode; ptr != NULL; ptr = ptr->next)
- if (0 == xmlStrcmp (ptr->name, "mime_type"))
- {
+ if (0 == xmlStrcmp (ptr->name, "mime_type")) {
char *name = xmlGetProp (ptr, "name");
char *priority = xmlGetProp (ptr, "priority");
char *support_clipboard = xmlGetProp (ptr, "clipboard");
@@ -133,7 +132,7 @@
for (i = 4; i >= 0; i--)
if (!strcmp (priority, GOPriorityName[i]))
break;
- g_free (priority);
+ xmlFree (priority);
/* FIXME FIXME FIXME the code should take into account that a plugin might be deactivated ! */
if (mime_type == NULL) {
@@ -149,12 +148,14 @@
g_hash_table_replace (mime_types, name,
mime_type);
} else if (i > mime_type->priority) {
- g_free (name);
+ xmlFree (name);
g_free (mime_type->component_type_name);
mime_type->component_type_name =
g_strdup (service->id);
mime_type->priority = i;
}
+ if (support_clipboard)
+ xmlFree (support_clipboard);
}
}
Modified: branches/goffice-0-6/goffice/graph/gog-plot-engine.c
==============================================================================
--- branches/goffice-0-6/goffice/graph/gog-plot-engine.c (original)
+++ branches/goffice-0-6/goffice/graph/gog-plot-engine.c Sun Jul 13 08:49:38 2008
@@ -297,24 +297,28 @@
return g_strdup (_("Plot Type"));
}
+static void gog_plot_family_free (GogPlotFamily *family);
+static void gog_plot_type_free (GogPlotType *type);
+
static void
gog_plot_type_service_finalize (GObject *obj)
{
GogPlotTypeService *service = GOG_PLOT_TYPE_SERVICE (obj);
GSList *ptr;
- for (ptr = service->families ; ptr != NULL ; ptr = ptr->next) {
- }
+ for (ptr = service->families ; ptr != NULL ; ptr = ptr->next)
+ gog_plot_family_free ((GogPlotFamily *) ptr->data);
g_slist_free (service->families);
service->families = NULL;
- for (ptr = service->types ; ptr != NULL ; ptr = ptr->next) {
- }
+ /* plot types are freed by gog_plot_family_free, so no need to
+ free anything but the list here */
g_slist_free (service->types);
service->types = NULL;
for (ptr = service->paths ; ptr != NULL ; ptr = ptr->next) {
g_hash_table_remove (pending_engines, ptr->data);
+ g_free (ptr->data);
}
g_slist_free (service->paths);
service->paths = NULL;
@@ -611,6 +615,28 @@
return g_strdup (_("Regression Curve Type"));
}
+static void gog_trend_line_type_free (GogTrendLineType *type);
+
+static void
+gog_trend_line_service_finalize (GObject *obj)
+{
+ GogTrendLineService *service = GOG_TREND_LINE_SERVICE (obj);
+ GSList *ptr;
+
+ for (ptr = service->types ; ptr != NULL ; ptr = ptr->next)
+ gog_trend_line_type_free ((GogTrendLineType *) ptr->data);
+ g_slist_free (service->types);
+ service->types = NULL;
+
+ for (ptr = service->paths ; ptr != NULL ; ptr = ptr->next) {
+ g_free (ptr->data);
+ }
+ g_slist_free (service->paths);
+ service->paths = NULL;
+
+ (plot_type_parent_klass->finalize) (obj);
+}
+
static void
gog_trend_line_service_init (GObject *obj)
{
@@ -620,8 +646,11 @@
}
static void
-gog_trend_line_service_class_init (GOPluginServiceClass *ps_class)
+gog_trend_line_service_class_init (GObjectClass *gobject_klass)
{
+ GOPluginServiceClass *ps_class = GPS_CLASS (gobject_klass);
+
+ gobject_klass->finalize = gog_trend_line_service_finalize;
ps_class->read_xml = gog_trend_line_service_read_xml;
ps_class->get_description = gog_trend_line_service_get_description;
ps_class->activate = gog_trend_line_service_activate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]