Created support to function qAddPostRoutine.
Created unit test for bug #515 Fixes bug #515 Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
This commit is contained in:
parent
1f1f82d582
commit
cc7d8dd138
3 changed files with 50 additions and 0 deletions
|
|
@ -596,6 +596,37 @@
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
|
|
||||||
|
<inject-code class="native" position="beginning">
|
||||||
|
namespace PySide {
|
||||||
|
static QStack<PyObject*> globalPostRoutineFunctions;
|
||||||
|
void globalPostRoutineCallback()
|
||||||
|
{
|
||||||
|
foreach(PyObject* callback, globalPostRoutineFunctions) {
|
||||||
|
Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL));
|
||||||
|
Py_DECREF(callback);
|
||||||
|
}
|
||||||
|
globalPostRoutineFunctions.clear();
|
||||||
|
}
|
||||||
|
void addPostRoutine(PyObject* callback)
|
||||||
|
{
|
||||||
|
if (PyCallable_Check(callback)) {
|
||||||
|
globalPostRoutineFunctions << callback;
|
||||||
|
Py_INCREF(callback);
|
||||||
|
} else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
</inject-code>
|
||||||
|
<add-function signature="qAddPostRoutine(PyObject*)">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
PySide::addPostRoutine(%1);
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
<inject-code class="target" position="end">
|
||||||
|
qAddPostRoutine(PySide::globalPostRoutineCallback);
|
||||||
|
</inject-code>
|
||||||
|
|
||||||
<inject-code class="target" position="end" file="glue/qt_version.cpp" />
|
<inject-code class="target" position="end" file="glue/qt_version.cpp" />
|
||||||
|
|
||||||
<add-function signature="__moduleShutdown()">
|
<add-function signature="__moduleShutdown()">
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ PYSIDE_TEST(bug_408.py)
|
||||||
PYSIDE_TEST(bug_428.py)
|
PYSIDE_TEST(bug_428.py)
|
||||||
PYSIDE_TEST(bug_462.py)
|
PYSIDE_TEST(bug_462.py)
|
||||||
PYSIDE_TEST(bug_505.py)
|
PYSIDE_TEST(bug_505.py)
|
||||||
|
PYSIDE_TEST(bug_515.py)
|
||||||
PYSIDE_TEST(blocking_signals_test.py)
|
PYSIDE_TEST(blocking_signals_test.py)
|
||||||
PYSIDE_TEST(child_event_test.py)
|
PYSIDE_TEST(child_event_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
|
|
|
||||||
18
tests/QtCore/bug_515.py
Normal file
18
tests/QtCore/bug_515.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
""" Unittest for bug #515 """
|
||||||
|
""" http://bugs.openbossa.org/show_bug.cgi?id=515 """
|
||||||
|
|
||||||
|
from PySide import QtCore
|
||||||
|
|
||||||
|
callCleanup = False
|
||||||
|
def _cleanup():
|
||||||
|
global callCleanup
|
||||||
|
callCleanup = True
|
||||||
|
|
||||||
|
def _checkCleanup():
|
||||||
|
global callCleanup
|
||||||
|
assert(callCleanup)
|
||||||
|
|
||||||
|
app = QtCore.QCoreApplication([])
|
||||||
|
QtCore.qAddPostRoutine(_cleanup)
|
||||||
|
QtCore.qAddPostRoutine(_checkCleanup)
|
||||||
|
del app
|
||||||
Loading…
Add table
Add a link
Reference in a new issue