aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-09-09 04:06:33 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-09-09 04:06:33 +0000
commitdf4fc5a5bf7bc65b610a497091f47e5ccc600874 (patch)
tree2c0b363210351aeb7109cf0fe946a2e053762423 /externals/grill/py/source
parent585f6de9b51870f5f8d60e39979eb43fe3d0e3a7 (diff)
""
svn path=/trunk/; revision=2020
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r--externals/grill/py/source/bound.cpp2
-rw-r--r--externals/grill/py/source/pyext.cpp15
-rw-r--r--externals/grill/py/source/pyext.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/externals/grill/py/source/bound.cpp b/externals/grill/py/source/bound.cpp
index 75a462e4..6fe0cd2b 100644
--- a/externals/grill/py/source/bound.cpp
+++ b/externals/grill/py/source/bound.cpp
@@ -132,6 +132,8 @@ V pyext::ClearBinding()
// in case the object couldn't be constructed...
if(!pyobj) return;
+ FLEXT_ASSERT(GetThis(pyobj));
+
void *data = NULL;
const t_symbol *sym = NULL;
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index adaacc0e..e8440081 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -87,6 +87,13 @@ pyext *pyext::GetThis(PyObject *self)
}
}
+void pyext::SetThis()
+{
+ // remember the this pointer
+ PyObject *th = PyLong_FromVoidPtr(this);
+ int ret = PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
+}
+
#if FLEXT_SYS == FLEXT_SYS_MAX
static short patcher_myvol(t_patcher *x)
@@ -254,11 +261,9 @@ pyext::~pyext()
BL pyext::DoInit()
{
- // remember the this pointer
- PyObject *th = PyLong_FromVoidPtr(this);
- int ret = PyObject_SetAttrString(pyobj,"_this",th); // ref is taken
+ SetThis();
- // call init now, after _this has been set, which is
+ // call init now, after _this has been set, which is
// important for eventual callbacks from __init__ to c
PyObject *pargs = MakePyArgs(NULL,args.Count(),args.Atoms(),-1,true);
if(!pargs) PyErr_Print();
@@ -330,6 +335,8 @@ V pyext::m_reload()
Reregister("_pyext"); // the others
Register("_pyext"); // self
+ SetThis();
+
PY_UNLOCK
}
diff --git a/externals/grill/py/source/pyext.h b/externals/grill/py/source/pyext.h
index c073fa74..4b3e1b17 100644
--- a/externals/grill/py/source/pyext.h
+++ b/externals/grill/py/source/pyext.h
@@ -65,6 +65,8 @@ private:
static V Setup(t_classid);
static pyext *GetThis(PyObject *self);
+ void SetThis();
+
V ClearBinding();
BL MakeInstance();
BL DoInit();