From b2982dccc5079395231450c21d26a2fc27c32940 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 11 Apr 2011 18:43:41 -0300 Subject: 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(-) (limited to 'PySide') diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 863c05634..eb3c45e15 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2178,9 +2178,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); + -- cgit v1.2.3