mirror of
https://github.com/thp/pyotherside.git
synced 2025-02-05 08:08:23 +08:00
Don't clean up an uninitialized renderer.
This commit is contained in:
parent
2662c423b4
commit
1ec78f422e
@ -136,8 +136,10 @@ void PyGLRenderer::render()
|
|||||||
|
|
||||||
void PyGLRenderer::cleanup()
|
void PyGLRenderer::cleanup()
|
||||||
{
|
{
|
||||||
QPythonPriv *priv = QPythonPriv::instance();
|
if (!m_initialized)
|
||||||
priv->enter();
|
return;
|
||||||
|
|
||||||
|
ENSURE_GIL_STATE;
|
||||||
|
|
||||||
PyObject *pyRendererObject = getPyRendererObject();
|
PyObject *pyRendererObject = getPyRendererObject();
|
||||||
if (!pyRendererObject || pyRendererObject == Py_None ||
|
if (!pyRendererObject || pyRendererObject == Py_None ||
|
||||||
@ -157,7 +159,7 @@ void PyGLRenderer::cleanup()
|
|||||||
PyObject *args = PyTuple_New(0);
|
PyObject *args = PyTuple_New(0);
|
||||||
PyObject *o = PyObject_Call(cleanupMethod, args, NULL);
|
PyObject *o = PyObject_Call(cleanupMethod, args, NULL);
|
||||||
if (o) Py_DECREF(o); else PyErr_PrintEx(0);
|
if (o) Py_DECREF(o); else PyErr_PrintEx(0);
|
||||||
m_initialized = true;
|
m_initialized = false;
|
||||||
Py_DECREF(args);
|
Py_DECREF(args);
|
||||||
Py_DECREF(cleanupMethod);
|
Py_DECREF(cleanupMethod);
|
||||||
priv->leave();
|
priv->leave();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user