Re: [gnome-db] GdaDataModelRows leaking?



On Thu, 2008-04-03 at 14:11 +0200, Vivien Malerba wrote:
> On Thu, Apr 3, 2008 at 11:31 AM, Murray Cumming <murrayc murrayc com> wrote:
> > (This is in libgda-3.0. I haven't looked at this in trunk.)
> 
> This only applies to V3, since for V4 the providers don't use that
> object anymore (but the
> global conception is almost the same).
> 
> Each GdaDataModel implementation which inherits the GdaDataModelRow
> class is repsonsible for managing its GdaRow objects, so the answer to
> your question is no, don't unref() the GdaRow.

Thanks.

But the postgres provider really doesn't seem to be managing the rows
that it creates. I think it's leaking the rows:
http://svn.gnome.org/viewvc/libgda/branches/release-3-0-branch/providers/postgres/gda-postgres-recordset.c?view=markup

This is the relevant code:

static GdaRow *
get_row (GdaDataModel *model, GdaPostgresRecordsetPrivate *priv, gint
rownum, GError **error)
{
	gchar *thevalue;
	GType ftype;
	gboolean isNull;
	GValue *value;
	GdaRow *row;
	gint i;
	gchar *id;
	gint length;
	
	row = gda_row_new (model, priv->ncolumns);
	for (i = 0; i < priv->ncolumns; i++) {
		thevalue = PQgetvalue (priv->pg_res, rownum, i);
		length = PQgetlength (priv->pg_res, rownum, i);
		ftype = priv->column_types [i];
		isNull = *thevalue != '\0' ? FALSE : PQgetisnull (priv->pg_res,
rownum, i);
		value = (GValue *) gda_row_get_value (row, i);
		gda_postgres_set_value (priv->cnc, value, ftype, thevalue, isNull,
length);
	}

	gda_row_set_number (row, rownum);
	id = g_strdup_printf ("%d", rownum);
   	/* Use oid or figure out primary keys ? could use libsql to add oid
to every query. */
	gda_row_set_id (row, id); /* FIXME: by now, the rowid is just the row
number */
	g_free (id);
	return row;
}

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]