From a89690409972501741c846ac8ad4a499f2982809 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Fri, 23 Mar 2018 19:54:42 +0100 Subject: fix more qApp crashes When building PySide with a debug Python, a lot more problems become visible. They were triggered by some malicious ordering of the shutdown code, which must come *after* the refcounts of the variables are adjusted. The initial issue PYSIDE-585 was caused because the shutdown code is not only used for every created Q*Application, but also for the module shutdown, which deletes qApp_contents too often. Instead of special-casing that or adding some refcount, it was much more intuitive in that context to set qApp_content's refcount to the same value as Py_None, which also is not supposed to be garbage collected. Btw., the reason for the error message is that Py_None has it, too. When we set qApp_content's type to Py_None's type, it inherits the protection code that prevents someone from garbage collecting Py_None. Task-number: PYSIDE-585 Change-Id: I4af9de1192730f06054a5aca099a32e2392e367d Reviewed-by: Friedemann Kleint --- sources/pyside2/libpyside/pyside.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/pyside2/libpyside') diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index b223edc6c..4c7e6471c 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -162,10 +162,10 @@ static void destructionVisitor(SbkObject* pyObj, void* data) void destroyQCoreApplication() { - SignalManager::instance().clear(); QCoreApplication* app = QCoreApplication::instance(); if (!app) return; + SignalManager::instance().clear(); Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); SbkObject* pyQApp = bm.retrieveWrapper(app); -- cgit v1.2.3