[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61233] trunk/blender/source/blender/ freestyle/intern/python/Iterator: Fix #37092 and #37381: crashes in the . object() method of Freestyle iterators.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Tue Nov 12 03:28:27 CET 2013


Revision: 61233
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61233
Author:   kjym3
Date:     2013-11-12 02:28:26 +0000 (Tue, 12 Nov 2013)
Log Message:
-----------
Fix #37092 and #37381: crashes in the .object() method of Freestyle iterators.
Now the method checks if the iterator is at the end, and returns None if that is the case.

Modified Paths:
--------------
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
    trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -115,6 +115,8 @@
 
 static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure))
 {
+	if (self->a_it->isEnd())
+		Py_RETURN_NONE;
 	ViewEdge *ve = self->a_it->operator*();
 	if (ve)
 		return BPy_ViewEdge_from_ViewEdge(*ve);

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -175,6 +175,8 @@
 
 static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure))
 {
+	if (self->c_it->isEnd())
+		Py_RETURN_NONE;
 	ViewEdge *ve = self->c_it->operator*();
 	if (ve)
 		return BPy_ViewEdge_from_ViewEdge(*ve);

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -97,6 +97,8 @@
 
 static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure))
 {
+	if (self->cp_it->isEnd())
+		Py_RETURN_NONE;
 	return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*());
 }
 

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -123,6 +123,8 @@
 
 static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
 {
+	if (self->if0D_it->isEnd())
+		Py_RETURN_NONE;
 	return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*());
 }
 

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -122,6 +122,8 @@
 
 static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure))
 {
+	if (!self->ve_it->isEnd())
+		Py_RETURN_NONE;
 	ViewEdge *ve = self->ve_it->operator*();
 	if (ve)
 		return BPy_ViewEdge_from_ViewEdge(*ve);

Modified: trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp	2013-11-11 20:37:19 UTC (rev 61232)
+++ trunk/blender/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp	2013-11-12 02:28:26 UTC (rev 61233)
@@ -103,6 +103,8 @@
 
 static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure))
 {
+	if (self->ove_it->isEnd())
+		Py_RETURN_NONE;
 	return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*());
 }
 




More information about the Bf-blender-cvs mailing list