aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-04-06 18:04:32 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-05-19 10:21:02 +0000
commit6c018822ba40cc0a4427bd3f9ab8c96829c207df (patch)
tree49ec39f1640a50bc084c84a20fc0d4a79b8712e3
parent51cb9304647fed901f3a19849d6758a757ce2d62 (diff)
Fix crash on exit with debug Python 35.6
Crash happens because of an use-after-free error. This is a bandaid fix transforming the crash into a memory leak. Proper fix will require more investigation and time. Task-number: PYSIDE-488 Change-Id: I56358573ca60d6f18fd85fbd7eb3eb0da8fbf163 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--libshiboken/sbkenum.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libshiboken/sbkenum.cpp b/libshiboken/sbkenum.cpp
index 0902077..009d9ab 100644
--- a/libshiboken/sbkenum.cpp
+++ b/libshiboken/sbkenum.cpp
@@ -487,7 +487,12 @@ bool createGlobalEnumItem(PyTypeObject* enumType, PyObject* module, const char*
if (enumItem) {
if (PyModule_AddObject(module, itemName, enumItem) < 0)
return false;
- Py_DECREF(enumItem);
+ // @TODO This Py_DECREF causes crashes on exit with a debug Python interpreter, essentially
+ // causing a use-after-free in the GC. This is now commented out to cause a memory leak
+ // instead of a crash. Proper memory management of Enum types and items should be
+ // implemented. See PYSIDE-488. This will require proper allocation and deallocation of
+ // the underlying Enum PyHeapType, which is currently just deallocated at application exit.
+ // Py_DECREF(enumItem);
return true;
}
return false;