Throw an exception when the user attempt to create more than one instance of QApplication.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
a642451bff
commit
8cd100beee
1 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,11 @@ extern PyObject* moduleQtGui;
|
||||||
|
|
||||||
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
|
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
|
||||||
{
|
{
|
||||||
|
if (QApplication::instance()) {
|
||||||
|
PyErr_SetString(PyExc_RuntimeError, "A QApplication instance already exists.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int numArgs = PyTuple_GET_SIZE(args);
|
int numArgs = PyTuple_GET_SIZE(args);
|
||||||
if (numArgs != 1) {
|
if (numArgs != 1) {
|
||||||
PyErr_BadArgument();
|
PyErr_BadArgument();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue