From d0ad9d27aa1b52d84e0f1fa2b3f0506e6571bb4a Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 11 Apr 2011 18:43:41 -0300 Subject: [PATCH] Fixed QCoreApplication.instance method to handle with application created before PySide module loading. Fixes bug #816. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtCore/typesystem_core.xml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 57f4c6a..b5678af 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2186,9 +2186,17 @@ - - - + + QCoreApplication* app = QCoreApplication::instance(); + PyObject* pyApp = Py_None; + if (app) { + pyApp = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper(app)); + if (!pyApp) + pyApp = %CONVERTTOPYTHON[QCoreApplication*](app); // this will keep app live after python exit (extra ref) + } + %PYARG_0 = pyApp; + Py_XINCREF(%PYARG_0); +