diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-29 04:11:41 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-29 04:11:41 +0400 |
commit | 8eb1064f4166cc939e2216e560a8e0f0a1ce76ce (patch) | |
tree | 034ba07e2b969b275f705edb1e38a4eb3832de10 | |
parent | 993ded0affdadce09a0dbd0c411ad7b4a5c4c11c (diff) |
Implemented a measure to avoid an infinite loop triggered when
ChainingIterator::init() and ChainingIterator::traverse() were
not properly overloaded in a subclass.
-rw-r--r-- | source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index df239793e3e..e6093236901 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -153,6 +153,10 @@ int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args ) } PyObject *ChainingIterator_init( BPy_ChainingIterator *self ) { + if( typeid(*(self->c_it)) == typeid(ChainingIterator) ) { + PyErr_SetString(PyExc_TypeError, "init() method must be overloaded"); + return NULL; + } self->c_it->init(); Py_RETURN_NONE; @@ -164,6 +168,10 @@ PyObject *ChainingIterator_traverse( BPy_ChainingIterator *self, PyObject *args if(!( PyArg_ParseTuple(args, "O!", &AdjacencyIterator_Type, &py_a_it) )) return NULL; + if( typeid(*(self->c_it)) == typeid(ChainingIterator) ) { + PyErr_SetString(PyExc_TypeError, "traverse() method must be overloaded"); + return NULL; + } if( ((BPy_AdjacencyIterator *) py_a_it)->a_it ) self->c_it->traverse(*( ((BPy_AdjacencyIterator *) py_a_it)->a_it )); |