Fixed QCoreApplication and QApplication cleanup.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
parent
2bd1bab4bb
commit
6320bfa4fa
2 changed files with 3 additions and 7 deletions
|
|
@ -10,10 +10,9 @@ void DeleteQCoreApplicationAtExit()
|
||||||
QCoreApplication *cpp = QCoreApplication::instance();
|
QCoreApplication *cpp = QCoreApplication::instance();
|
||||||
if (cpp) {
|
if (cpp) {
|
||||||
Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance();
|
Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance();
|
||||||
PyObject* pySelf = bmngr.retrieveWrapper(cpp);
|
|
||||||
cpp->flush();
|
cpp->flush();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
bmngr.invalidateWrapper(pySelf);
|
bmngr.destroyWrapper(cpp);
|
||||||
delete cpp;
|
delete cpp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,15 @@ void DeleteQApplicationAtExit()
|
||||||
|
|
||||||
// Delete all widgets, this is slow but is necessary to avoid problems with python object
|
// Delete all widgets, this is slow but is necessary to avoid problems with python object
|
||||||
foreach(QWidget* w, QApplication::allWidgets()) {
|
foreach(QWidget* w, QApplication::allWidgets()) {
|
||||||
PyObject* pySelf = bmngr.retrieveWrapper(w);
|
|
||||||
|
|
||||||
w->deleteLater();
|
w->deleteLater();
|
||||||
//Make sure all events will send before invalidated the python object
|
//Make sure all events will send before invalidated the python object
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
bmngr.invalidateWrapper(pySelf);
|
bmngr.destroyWrapper(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* pySelf = bmngr.retrieveWrapper(cpp);
|
|
||||||
cpp->deleteLater();
|
cpp->deleteLater();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
bmngr.invalidateWrapper(pySelf);
|
bmngr.destroyWrapper(cpp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue