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>
This commit is contained in:
parent
6da3e78014
commit
d0ad9d27aa
1 changed files with 11 additions and 3 deletions
|
|
@ -2186,9 +2186,17 @@
|
||||||
<modify-function signature="sendPostedEvents(QObject*, int)" allow-thread="yes"/>
|
<modify-function signature="sendPostedEvents(QObject*, int)" allow-thread="yes"/>
|
||||||
<modify-function signature="sendPostedEvents()" allow-thread="yes"/>
|
<modify-function signature="sendPostedEvents()" allow-thread="yes"/>
|
||||||
<modify-function signature="instance()">
|
<modify-function signature="instance()">
|
||||||
<modify-argument index="return">
|
<inject-code class="target">
|
||||||
<define-ownership owner="c++"/>
|
QCoreApplication* app = QCoreApplication::instance();
|
||||||
</modify-argument>
|
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>
|
||||||
|
|
||||||
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
|
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue