diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-27 14:20:36 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-27 14:20:36 +0200 |
commit | 25f899e276c00b8d7f334819d6cd7927ed67093a (patch) | |
tree | d2a063aab76e0435eb862ca5d2b541a5e718f062 /sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp | |
parent | 4725008aeea407ae55cfd66de802dd9e06412efc (diff) | |
parent | e30e0c161b2b4d50484314bf006e9e5e8ff6b380 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.9
Change-Id: I94cb5a7dab97cff3591bac534228bfd3e3ad5938
Diffstat (limited to 'sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp')
-rw-r--r-- | sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp index c48b4ffa0..b2dfae38f 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of PySide2. @@ -37,27 +37,14 @@ ** ****************************************************************************/ -// Global variables used to store argc and argv values -static int QCoreApplicationArgCount; -static char** QCoreApplicationArgValues; - -void QCoreApplication_constructor(PyObject* self, PyObject* args, QCoreApplicationWrapper** cptr) +static void QCoreApplicationConstructor(PyObject *self, PyObject *pyargv, QCoreApplicationWrapper **cptr) { - if (QCoreApplication::instance()) { - PyErr_SetString(PyExc_RuntimeError, "A QCoreApplication instance already exists."); - return; - } - - int numArgs = PyTuple_GET_SIZE(args); - if (numArgs != 1 - || !Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { - PyErr_BadArgument(); - return; + static int argc; + static char **argv; + PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0); + if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) { + *cptr = new QCoreApplicationWrapper(argc, argv); + Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self)); + PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); } - - *cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues, QT_VERSION); - - Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self)); - PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); - Py_INCREF(self); } |