diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-01-27 14:28:59 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-01-27 16:57:28 -0200 |
commit | 8cd100beee09b2bd8305e124fb52fc1f5025584c (patch) | |
tree | d4b5fce9128346c880528a699bf410d6cc8c2d20 /PySide/QtGui/glue | |
parent | a642451bfff138257e3c706f0c87590fd8269056 (diff) |
Throw an exception when the user attempt to create more than one instance of QApplication.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'PySide/QtGui/glue')
-rw-r--r-- | PySide/QtGui/glue/qapplication_init.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index 265db256b..469e18c99 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -3,6 +3,11 @@ extern PyObject* moduleQtGui; 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); if (numArgs != 1) { PyErr_BadArgument(); |