diff options
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 14 |
1 files changed, 11 insertions, 3 deletions
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 @@ <modify-function signature="sendPostedEvents(QObject*, int)" allow-thread="yes"/> <modify-function signature="sendPostedEvents()" allow-thread="yes"/> <modify-function signature="instance()"> - <modify-argument index="return"> - <define-ownership owner="c++"/> - </modify-argument> + <inject-code class="target"> + 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); + </inject-code> </modify-function> <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> |