[pygi] Fix passing GDestroyNotify
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] Fix passing GDestroyNotify
- Date: Mon, 3 May 2010 16:43:49 +0000 (UTC)
commit 3e61e7d4450a2bb133c7f3862e0962a35339ce8d
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Mon May 3 18:35:13 2010 +0200
Fix passing GDestroyNotify
https://bugzilla.gnome.org/show_bug.cgi?id=617542
gi/pygi-invoke.c | 3 ++-
tests/test_everything.py | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index 431e0fe..aa8c5f3 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -391,7 +391,8 @@ _prepare_invocation_state (struct invocation_state *state,
py_args_pos++;
continue;
} else if (i == state->destroy_notify_index) {
- state->args[i]->v_pointer = _pygi_destroy_notify_create();
+ PyGICClosure *destroy_notify = _pygi_destroy_notify_create();
+ state->args[i]->v_pointer = destroy_notify->closure;
continue;
}
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 32ce389..de016e9 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -172,3 +172,13 @@ class TestCallbacks(unittest.TestCase):
TestCallbacks.main_loop.run()
self.assertTrue(TestCallbacks.called)
+
+ def testCallbackDestroyNotify(self):
+ def callback(user_data):
+ TestCallbacks.called = True
+ return 42
+
+ TestCallbacks.called = False
+ self.assertEquals(Everything.test_callback_destroy_notify(callback, 42), 42)
+ self.assertTrue(TestCallbacks.called)
+ self.assertEquals(Everything.test_callback_thaw_notifications(), 42)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]