From: Joseph Sutton Date: Mon, 13 Nov 2023 23:34:01 +0000 (+1300) Subject: python:tests: Fix crashing pymessaging tests X-Git-Tag: talloc-2.4.2~675 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=beff3e6d7762b423500a7ebf163878ede68b4a2f;p=thirdparty%2Fsamba.git python:tests: Fix crashing pymessaging tests Commit 8c75d9fc73614fad29a998d08c4b11034ab2aebb changed Messaging.deregister() to take a two‐element tuple containing private data as well as a callback, but it did not change the call in samba.tests.messaging.MessagingTests.test_register to match. Since imessaging_deregister() completely ignored the ‘private_data’ parameter passed to it (assuming the callback was registered with msg_type == -1), everything still appeared to work — until commit b22c21799527323877b330c16c23057582721abb changed Messaging.deregister() to no longer leak memory. Now the wrong variable had its reference count decremented, causing the test to crash. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/messaging.py b/python/samba/tests/messaging.py index 7a4aa17b9d5..c772db08041 100644 --- a/python/samba/tests/messaging.py +++ b/python/samba/tests/messaging.py @@ -39,9 +39,10 @@ class MessagingTests(TestCase): def callback(): pass - msg_type = x.register((callback, None)) + callback_and_context = (callback, None) + msg_type = x.register(callback_and_context) self.assertTrue(isinstance(msg_type, int)) - x.deregister(callback, msg_type) + x.deregister(callback_and_context, msg_type) def test_all_servers(self): x = self.get_context()