[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22002] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp: Implemented a measure to avoid an infinite loop triggered when

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Wed Jul 29 02:11:41 CEST 2009


Revision: 22002
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22002
Author:   kjym3
Date:     2009-07-29 02:11:41 +0200 (Wed, 29 Jul 2009)

Log Message:
-----------
Implemented a measure to avoid an infinite loop triggered when
ChainingIterator::init() and ChainingIterator::traverse() were
not properly overloaded in a subclass.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp	2009-07-28 22:44:50 UTC (rev 22001)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp	2009-07-29 00:11:41 UTC (rev 22002)
@@ -153,6 +153,10 @@
 }
 
 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 @@
 	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 ));
 		





More information about the Bf-blender-cvs mailing list