From 96a9e4a5b55cde0cc1b13a583dbb28b14fbce46c Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sat, 29 Apr 2006 18:49:45 +0000 Subject: Fix #154845, add tests and a private method. * gobject/pygtype.c (gclosure_from_pyfunc): * gobject/pygobject.c (pygobject_disconnect_by_func) (pygobject_handler_block_by_func) (pygobject_handler_unblock_by_func): * tests/test_signal.py (TestEmissionHook._callback): Fix #154845, add tests and a private method. --- gobject/pygtype.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gobject/pygtype.c') diff --git a/gobject/pygtype.c b/gobject/pygtype.c index a1400a0..296f48f 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -1306,6 +1306,21 @@ pyg_signal_class_closure_get(void) return closure; } +GClosure * +gclosure_from_pyfunc(PyGObject *object, PyObject *func) +{ + GSList *l; + + for (l = object->closures; l; l = l->next) { + PyGClosure *pyclosure = l->data; + if (PyFunction_GetClosure(pyclosure->callback) == + PyFunction_GetClosure(func)) { + return (GClosure*)pyclosure; + } + } + return NULL; +} + /* ----- __doc__ descriptor for GObject and GInterface ----- */ static void -- cgit