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()
|
||||
{
|
||||
QPythonPriv *priv = QPythonPriv::instance();
|
||||
priv->enter();
|
||||
if (!m_initialized)
|
||||
return;
|
||||
|
||||
ENSURE_GIL_STATE;
|
||||
|
||||
PyObject *pyRendererObject = getPyRendererObject();
|
||||
if (!pyRendererObject || pyRendererObject == Py_None ||
|
||||
@ -157,7 +159,7 @@ void PyGLRenderer::cleanup()
|
||||
PyObject *args = PyTuple_New(0);
|
||||
PyObject *o = PyObject_Call(cleanupMethod, args, NULL);
|
||||
if (o) Py_DECREF(o); else PyErr_PrintEx(0);
|
||||
m_initialized = true;
|
||||
m_initialized = false;
|
||||
Py_DECREF(args);
|
||||
Py_DECREF(cleanupMethod);
|
||||
priv->leave();
|
||||
|
Loading…
x
Reference in New Issue
Block a user