[gnome-db] GdaDataModelRows leaking?



(This is in libgda-3.0. I haven't looked at this in trunk.)

Should the result of gda_data_model_row_get_row() (or the
GdaDataModelRowClass::get_row() vfunc) be unrefed? It has no
documentation. The postgres implementation always returns a new
instance:

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);
...
}


but the row is not unrefed when used, for instance here:

static gboolean
gda_data_model_row_set_value_at (GdaDataModel *model, gint col, gint
row, 
				 const GValue *value, GError **error)
{
	GdaRow *gdarow;

	g_return_val_if_fail (GDA_IS_DATA_MODEL_ROW (model), FALSE);
	g_return_val_if_fail (row >= 0, FALSE);
	g_return_val_if_fail (CLASS (model)->update_row != NULL, FALSE);
	g_return_val_if_fail (CLASS (model)->get_row != NULL, FALSE);

	if (((GdaDataModelRow *)model)->priv->read_only) {
		g_warning ("Attempting to modify a read-only data model");
		return FALSE;
	}

	gdarow = CLASS (model)->get_row (GDA_DATA_MODEL_ROW (model), row,
error);
	if (gdarow) {
		gda_row_set_value (gdarow, col, value);
		return CLASS (model)->update_row (GDA_DATA_MODEL_ROW (model), gdarow,
error);
	}
	else
		return FALSE;
}


or here:

static const GValue *
gda_postgres_recordset_get_value_at (GdaDataModelRow *model, gint col,
gint row)
{
	...
	
	row_list = get_row (GDA_DATA_MODEL (model), priv_data, row, NULL);
	gda_data_model_hash_insert_row (GDA_DATA_MODEL_HASH (model),
					 row, row_list);
        return gda_row_get_value (row_list, col);
}


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



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