Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-21 23:44:15 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-21 23:44:15 +0400
commitf19ae708206260dd4d703d6099100eddd90fe9c9 (patch)
tree26d56a0e802e1876170d30bcd765973f5e12a42a /source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
parent5fed0560d9184d9dd64625ce6af70f67e0ad0960 (diff)
Fixed a refcount bug concerning ChainPredicateIterator.
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
index 79ef0a93dba..75083e623e7 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
@@ -13,6 +13,7 @@ extern "C" {
/*--------------- Python API function prototypes for ChainPredicateIterator instance -----------*/
static int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *args);
+static void ChainPredicateIterator___dealloc__(BPy_ChainPredicateIterator *self);
/*----------------------ChainPredicateIterator instance definitions ----------------------------*/
static PyMethodDef BPy_ChainPredicateIterator_methods[] = {
@@ -30,7 +31,7 @@ PyTypeObject ChainPredicateIterator_Type = {
0, /* tp_itemsize */
/* methods */
- NULL, /* tp_dealloc */
+ (destructor)ChainPredicateIterator___dealloc__, /* tp_dealloc */
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
@@ -116,6 +117,8 @@ int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *
if( obj1 && BPy_ChainPredicateIterator_Check(obj1) ) {
self->cp_it = new ChainPredicateIterator(*( ((BPy_ChainPredicateIterator *) obj1)->cp_it ));
+ self->upred = NULL;
+ self->bpred = NULL;
} else if( obj1 && BPy_UnaryPredicate1D_Check(obj1) &&
obj2 && BPy_BinaryPredicate1D_Check(obj2) ) {
@@ -144,6 +147,10 @@ int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *
bool orientation = ( obj6 ) ? bool_from_PyBool(obj6) : true;
self->cp_it = new ChainPredicateIterator( *up1D, *bp1D, restrictToSelection, restrictToUnvisited, begin, orientation);
+ self->upred = obj1;
+ self->bpred = obj2;
+ Py_INCREF( self->upred );
+ Py_INCREF( self->bpred );
} else {
bool restrictToSelection = ( obj1 ) ? bool_from_PyBool(obj1) : true;
@@ -160,6 +167,8 @@ int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *
bool orientation = ( obj4 ) ? bool_from_PyBool(obj4) : true;
self->cp_it = new ChainPredicateIterator( restrictToSelection, restrictToUnvisited, begin, orientation);
+ self->upred = NULL;
+ self->bpred = NULL;
}
self->py_c_it.c_it = self->cp_it;
@@ -171,6 +180,12 @@ int ChainPredicateIterator___init__(BPy_ChainPredicateIterator *self, PyObject *
}
+void ChainPredicateIterator___dealloc__(BPy_ChainPredicateIterator *self)
+{
+ Py_XDECREF( self->upred );
+ Py_XDECREF( self->bpred );
+ ChainingIterator_Type.tp_dealloc((PyObject *)self);
+}
///////////////////////////////////////////////////////////////////////////////////////////