Vivien Malerba wrote:
Thanks, that fixed it. The g_object_unref now does close the connection, so no unexpected EOF in the PostgreSQL log. This is something I find difficult in glib/gnome programming in general - how to know when something needs to be unref'ed, and when something else might be keeping a reference to your object. For example, nothing in the gda_connection_statement_execute or gda_connection_statement_execute_select documentation indicates that the connection reference count will be incremented. The GdaDataModel page does not even contain the word connection.> I don't think I have 2 references to the connection. I've attached a current snapshot of my file to let you see it. It's a work in progress for a test case for one of my bugs.The problem comes from the fact that when you call g_object_unref(pConn), there is still an object holding a reference on the pConn object, it is the GdaDataModel returned from the gda_connection_statement_execute_select() function (which you ignore in your example but still exists). Here is attached your example, modified to show the reference count on the pConn object. Cheers, Vivien
Mark