Change destruction order of PyObjects

This commit is contained in:
wmayer 2012-11-01 20:52:43 +01:00
parent 883259d146
commit 7862fb29c7

View File

@ -184,9 +184,10 @@ Py::Object PythonDebugStdout::repr()
Py::Object PythonDebugStdout::write(const Py::Tuple& args) Py::Object PythonDebugStdout::write(const Py::Tuple& args)
{ {
char *msg; char *msg;
PyObject* pObj; //PyObject* pObj;
//args contains a single parameter which is the string to write. ////args contains a single parameter which is the string to write.
if (!PyArg_ParseTuple(args.ptr(), "Os:OutputString", &pObj, &msg)) //if (!PyArg_ParseTuple(args.ptr(), "Os:OutputString", &pObj, &msg))
if (!PyArg_ParseTuple(args.ptr(), "s:OutputString", &msg))
throw Py::Exception(); throw Py::Exception();
if (strlen(msg) > 0) if (strlen(msg) > 0)
@ -340,6 +341,7 @@ struct PythonDebuggerP {
PyObject* out_n; PyObject* out_n;
PyObject* err_n; PyObject* err_n;
PyObject* exc_n; PyObject* exc_n;
PythonDebugExcept* pypde;
bool init, trystop, running; bool init, trystop, running;
QEventLoop loop; QEventLoop loop;
PyObject* pydbg; PyObject* pydbg;
@ -351,10 +353,9 @@ struct PythonDebuggerP {
Base::PyGILStateLocker lock; Base::PyGILStateLocker lock;
out_n = new PythonDebugStdout(); out_n = new PythonDebugStdout();
err_n = new PythonDebugStderr(); err_n = new PythonDebugStderr();
PythonDebugExcept* err = new PythonDebugExcept(); pypde = new PythonDebugExcept();
Py::Object func = err->getattr("fc_excepthook"); Py::Object func = pypde->getattr("fc_excepthook");
exc_n = Py::new_reference_to(func); exc_n = Py::new_reference_to(func);
Py_DECREF(err);
pydbg = new PythonDebuggerPy(that); pydbg = new PythonDebuggerPy(that);
} }
~PythonDebuggerP() ~PythonDebuggerP()
@ -362,6 +363,7 @@ struct PythonDebuggerP {
Py_DECREF(out_n); Py_DECREF(out_n);
Py_DECREF(err_n); Py_DECREF(err_n);
Py_DECREF(exc_n); Py_DECREF(exc_n);
Py_DECREF(pypde);
Py_DECREF(pydbg); Py_DECREF(pydbg);
} }
}; };