X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/059a841c9651ba15b1ecc7a8c35189a813a122eb..bf44306ebca5d26e204ef17851516d844bc2f0a7:/wxPython/src/helpers.h diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index cae2b86d8f..46d04e9f60 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -351,6 +351,29 @@ public: +class wxPyClientData : public wxClientData { +public: + wxPyClientData(PyObject* obj) { + m_obj = obj; + Py_INCREF(m_obj); + } + + ~wxPyClientData() { +#ifdef wxPyUSE_EXPORT + wxPyTState* state = wxPyCoreAPIPtr->p_wxPyBeginBlockThreads(); + Py_DECREF(m_obj); + wxPyCoreAPIPtr->p_wxPyEndBlockThreads(state); +#else + wxPyTState* state = wxPyBeginBlockThreads(); + Py_DECREF(m_obj); + wxPyEndBlockThreads(state); +#endif + } + PyObject* m_obj; +}; + + + //--------------------------------------------------------------------------- // These macros are used to implement the virtual methods that should // redirect to a Python method if one exists. The names designate the