From f21ed0581fa0fb352480833186cf8f43d1c22fa0 Mon Sep 17 00:00:00 2001 From: Adrian Herrmann Date: Fri, 2 Jun 2023 17:28:46 +0200 Subject: Revert anonymous slot memory leak fix The fix to PYSIDE-2299 unfortunately introduces regressions that are more serious than the memory leak caused by an edge case that was originally supposed to be fixed. A different approach will be needed to fix the memory leak, in the meantime, revert the change. The corresponding unit test remains blacklisted, as it will apply to a future fix. Fixes: PYSIDE-2346 Task-number: PYSIDE-2299 Change-Id: I1dcddb03f731a333f6acf7c9df79b9dba42bec21 Reviewed-by: Christian Tismer (cherry picked from commit 0bf8ce7022f55dd816f5f0c3e8209f515e411c76) Reviewed-by: Qt Cherry-pick Bot --- build_history/blacklist.txt | 4 ++++ sources/pyside6/libpyside/globalreceiverv2.cpp | 11 +---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/build_history/blacklist.txt b/build_history/blacklist.txt index 475e5d40e..1da2b0ca0 100644 --- a/build_history/blacklist.txt +++ b/build_history/blacklist.txt @@ -6,6 +6,10 @@ linux darwin win32 +[signals::anonymous_slot_leak_test] + linux + darwin + win32 [Qt3DExtras::qt3dextras_test] win32 ci linux diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp index b8c542eb1..8289eaff6 100644 --- a/sources/pyside6/libpyside/globalreceiverv2.cpp +++ b/sources/pyside6/libpyside/globalreceiverv2.cpp @@ -106,16 +106,7 @@ GlobalReceiverKey DynamicSlotDataV2::key(PyObject *callback) Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PySideName::im_func())); return {self, func}; } - // PYSIDE-2299: Callbacks can have the same code, but we only need one GlobalReceiverV2 for all - // of them. If we used the callback itself instead of the code object, we would - // create a new GlobalReceiverV2 for each in SignalManager::globalReceiver() - // (signalmanager.cpp), leaking memory. - - // TODO: Need proper fix. This is temporary - if (std::strcmp(Py_TYPE(callback)->tp_name, "functools.partial") == 0) - return {nullptr, callback}; - - return {nullptr, PyFunction_GetCode(callback)}; + return {nullptr, callback}; } PyObject *DynamicSlotDataV2::callback() -- cgit v1.2.3