From 965c46b1d3e3f4907c5d4d32c343809470ae9bca Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 25 Feb 2011 15:07:25 +0000 Subject: follow up on patch [#26215], not all weakref references were ifdef'd --- source/gameengine/Expressions/PyObjectPlus.cpp | 4 ++++ source/gameengine/Expressions/PyObjectPlus.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 84d6a1cba4b..e205ddfda2e 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -1122,7 +1122,9 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v self->m_proxy = reinterpret_castPyObject_NEW( PyObjectPlus_Proxy, tp); BGE_PROXY_PYOWNS(self->m_proxy) = false; BGE_PROXY_PYREF(self->m_proxy) = true; +#ifdef USE_WEAKREFS BGE_PROXY_WKREF(self->m_proxy) = NULL; +#endif } //PyObject_Print(self->m_proxy, stdout, 0); //printf("ref %d\n", self->m_proxy->ob_refcnt); @@ -1143,7 +1145,9 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v BGE_PROXY_PYOWNS(proxy) = py_owns; BGE_PROXY_REF(proxy) = NULL; BGE_PROXY_PTR(proxy) = ptr; +#ifdef USE_WEAKREFS BGE_PROXY_WKREF(self->m_proxy) = NULL; +#endif return proxy; } if (self->m_proxy) diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 315a328317d..7d06cc64ee9 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -108,7 +108,9 @@ typedef struct PyObjectPlus_Proxy { #define BGE_PROXY_PTR(_self) (((PyObjectPlus_Proxy *)_self)->ptr) #define BGE_PROXY_PYOWNS(_self) (((PyObjectPlus_Proxy *)_self)->py_owns) #define BGE_PROXY_PYREF(_self) (((PyObjectPlus_Proxy *)_self)->py_ref) -#define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist) +#ifdef USE_WEAKREFS + #define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist) +#endif /* Note, sometimes we dont care what BGE type this is as long as its a proxy */ #define BGE_PROXY_CHECK_TYPE(_type) ((_type)->tp_dealloc == PyObjectPlus::py_base_dealloc) -- cgit v1.2.3