diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-04-11 18:43:41 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:09 -0300 |
commit | b2982dccc5079395231450c21d26a2fc27c32940 (patch) | |
tree | 742e012eada35ef05a095e20e723f67ec07dd97e /PySide | |
parent | 442a0ca932a663251deeefb37428b4d8df70a139 (diff) |
Fixed QCoreApplication.instance method to handle with application created before PySide module loading.
Fixes bug #816.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'PySide')
-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"/> |