On Mon, 2005-07-25 at 08:54 +0100, Magnus Therning wrote: > Any advise on debugging Python extensions? If you want to figure out what's happening with reference counting, you can use GDB. Each GObject has an associated PyObject, and they reference each other. If you break (Ctrl-C) in GDB and have found a GObject, you can find the associated PyObject in GDB with the following code: p quark = g_quark_from_static_string("PyGObject::wrapper"); p pyobj_inst = (PyGObject *) g_object_get_qdata(gobject_inst, quark); And you can look at both of the object's reference counts: p gobject_inst->ref_count; p pyobj_inst->ob_refcnt; They both reference each other, so gobject_inst->ref_count and pyobj_inst->ob_refcnt are each 1 higher than they "ought" to be (i.e., if no reference were held in either Python or core Epiphany, they would be 1 and 1 -- and then the Python garbage collector would clean them up). However, using GDB to debug Python is rather involved. In my case I've only ever needed it when debugging Pyphany itself. Within Python, all I've ever done is prototype extensions using the Python Console, and then just write that code into a .py for an extension. It's always Just Worked. Maybe a few "print" statements within your Python code can help you debug. Within your Python extension, I think you can't hold any global variables pointing to EphyWindows or EphyTabs or the EphyShell; doing so might stop Epiphany from shutting down properly. There are probably exceptions (maybe keeping an EphyShell would work fine, I've never tried), but you shouldn't do it. -- Adam Hooper <adamh densi com>
Attachment:
signature.asc
Description: This is a digitally signed message part