summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:05:47 +0000
committerFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:05:47 +0000
commit281e9a81aeb2fe642dfd1d186165db7490c0a920 (patch)
tree5ac69867be62a2b42ea69e6ea28619a76d466968 /bindings
parent8a6602b62be0b26bf500754b1c0dc466892051ab (diff)
downloadlasso-281e9a81aeb2fe642dfd1d186165db7490c0a920.tar.gz
lasso-281e9a81aeb2fe642dfd1d186165db7490c0a920.tar.xz
lasso-281e9a81aeb2fe642dfd1d186165db7490c0a920.zip
[project @ fpeters@0d.be-20071115102943-ai5s97yj5g9chrv3]
added getter for internal GObject* reference count; useful to debug memory allocations. Original author: Frederic Peters <fpeters@0d.be> Date: 2007-11-15 11:29:43.003000+01:00
Diffstat (limited to 'bindings')
-rw-r--r--bindings/lang_python_wrapper_top.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/bindings/lang_python_wrapper_top.c b/bindings/lang_python_wrapper_top.c
index fc2769f9..74cc1c74 100644
--- a/bindings/lang_python_wrapper_top.c
+++ b/bindings/lang_python_wrapper_top.c
@@ -215,6 +215,21 @@ static PyMemberDef PyGObjectPtr_members[] = {
{NULL}
};
+static PyObject* PyGObjectPtr_get_refcount(PyGObjectPtr *self, void *closure)
+{
+ PyObject *refcount;
+
+ refcount = PyInt_FromLong(self->obj->ref_count);
+ Py_INCREF(refcount);
+ return refcount;
+}
+
+static PyGetSetDef PyGObjectPtr_getseters[] = {
+ {"refcount", (getter)PyGObjectPtr_get_refcount, NULL,
+ "reference count of intern GObject*", NULL},
+ {NULL} /* Sentinel */
+};
+
static PyTypeObject PyGObjectPtrType = {
PyObject_HEAD_INIT(NULL)
@@ -247,5 +262,6 @@ static PyTypeObject PyGObjectPtrType = {
0, /* tp_iternext */
0, /* tp_methods */
PyGObjectPtr_members, /* tp_members */
+ PyGObjectPtr_getseters, /* tp_getset */
};