[Gtk-sharp-list] too many GDA nullpointers!!

Murray Cumming murrayc@murrayc.com
Mon, 12 Apr 2004 14:47:46 +0200


I just wrapped this stuff for C++, so here's a clue: memory-management
of Parameters/ParameterLists is bizarre - the functions _take_ ownership
of the Parameters, so you need to be sure that the caller does not free
it from the caller. It's mentioned in the C documentation.

Or, maybe that's not the problem.

On Sat, 2004-04-10 at 18:33, Soeren wrote:
> Im trying to figure out how to use the wrapper
> for Gnome Data Access (GDA) but I keep getting
> nullpointers all over the place.
> 
> For instance if I try to get a value from a 
> datamodel row or directly from the datamodel:
> 
> 	DataModel dm = 
> 		conn.ExecuteSingleCommand(cmd, new ParameterList());
> 	int n = dm.NRows;
> 	for (int rowindex=0; rowindex<n; rowindex++) {
> 		Row row = dm.GetRow(rowindex);
> 		Gda.Value val = row.GetValue(1);  // <- nullptr inside GetValue()!!
> 		row.Free();
> 	}
> 
> The datamodel in this case consists of two cols (id int and name 
> varchar(50)) and contains 4 rows (the property NRows confirm this).
> If I try to use the method DataModel.GetValueAt(col,row) then I get
> a nullptr as well.
> 
> Unhandled Exception: System.NullReferenceException: A null value was
> found where an object instance was required.
> in (unmanaged) /usr/local/lib/libmono.so.0(mono_string_new+0x1d)
> [0x40084685]
> in (unmanaged) /usr/local/lib/libmono.so.0(mono_string_new_wrapper+0x2d)
> [0x40084711]
> in <0x00205> (wrapper unknown) Gda.Value:PtrToStructure (intptr,object)
> in (unmanaged) /usr/local/lib/libmono.so.0 [0x4004901b]
> in (unmanaged) /usr/local/lib/libmono.so.0(mono_runtime_invoke+0x23)
> [0x40082e47]
> in (unmanaged) /usr/local/lib/libmono.so.0 [0x4009dd08]
> in (unmanaged) /usr/local/lib/libmono.so.0 [0x4009dd9a]
> in <0x000b3> Gda.Value:New (intptr)
> in <0x00055> Gda.Row:GetValue (int)
> in <0x0016e> ChessServer.Datamodel.GameDatabase:Run ()
> in <0x00031> ChessServer.Datamodel.GameDatabase:Main ()
> 
> 
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-- 
Murray Cumming
www.murrayc.com
murrayc@murrayc.com