Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24767/python
Modified Files:
gump.h pyaccount.cpp target.cpp target.h tempeffect.h
Log Message:
Fixed MANY memory leaks.
Index: tempeffect.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/tempeffect.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** tempeffect.h 19 Sep 2004 22:13:37 -0000 1.31
--- tempeffect.h 25 Sep 2004 02:03:22 -0000 1.32
***************
*** 52,55 ****
--- 52,56 ----
{
objectid = "cPythonEffect";
+ args = 0;
}
***************
*** 62,66 ****
virtual ~cPythonEffect()
{
! ;}
void setDispelId( const QString& data )
--- 63,68 ----
virtual ~cPythonEffect()
{
! Py_XDECREF( args );
! }
void setDispelId( const QString& data )
***************
*** 85,89 ****
{
// We will ignore silent here.
! Dispel( pSource, PyList_New( 0 ) );
}
--- 87,93 ----
{
// We will ignore silent here.
! PyObject *list = PyList_New( 0 );
! Dispel( pSource, list );
! Py_DECREF(list);
}
***************
*** 111,114 ****
--- 115,119 ----
// Create our Argument list
PyObject* p_args = PyTuple_New( 4 );
+
if ( isItemSerial( destSer ) )
PyTuple_SetItem( p_args, 0, PyGetItemObject( FindItemBySerial( destSer ) ) );
***************
*** 123,127 ****
--- 128,134 ----
Py_INCREF(args); // PyTuple_SetItem steals a reference
PyTuple_SetItem( p_args, 1, args );
+
PyTuple_SetItem( p_args, 2, PyGetCharObject( pSource ) );
+
Py_INCREF(disp_args);
PyTuple_SetItem( p_args, 3, disp_args );
***************
*** 131,143 ****
reportPythonError( sModule );
Py_DECREF( p_args );
}
-
Py_XDECREF( pFunc );
}
Py_XDECREF( pModule );
}
-
- Py_DECREF( args );
}
--- 138,148 ----
reportPythonError( sModule );
+
Py_DECREF( p_args );
}
Py_XDECREF( pFunc );
}
Py_XDECREF( pModule );
}
}
***************
*** 175,180 ****
PyObject* result = PyEval_CallObject( pFunc, p_args );
Py_XDECREF( result );
- reportPythonError( sModule );
Py_DECREF( p_args );
}
--- 180,185 ----
PyObject* result = PyEval_CallObject( pFunc, p_args );
Py_XDECREF( result );
+ reportPythonError( sModule );
Py_DECREF( p_args );
}
***************
*** 183,188 ****
Py_XDECREF( pModule );
}
-
- Py_DECREF( args );
}
--- 188,191 ----
Index: target.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** target.cpp 19 Sep 2004 22:13:37 -0000 1.2
--- target.cpp 25 Sep 2004 02:03:22 -0000 1.3
***************
*** 145,150 ****
Py_XDECREF( pModule );
}
-
- Py_DECREF( args );
return true;
}
--- 145,148 ----
***************
*** 181,186 ****
Py_XDECREF( pModule );
}
-
- Py_DECREF( args );
}
--- 179,182 ----
***************
*** 217,221 ****
Py_XDECREF( pModule );
}
-
- Py_DECREF( args );
}
--- 213,215 ----
Index: target.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/target.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** target.h 16 Sep 2004 01:40:19 -0000 1.24
--- target.h 25 Sep 2004 02:03:22 -0000 1.25
***************
*** 63,66 ****
--- 63,70 ----
}
+ virtual ~cPythonTarget() {
+ Py_XDECREF(args);
+ }
+
bool responsed( cUOSocket* socket, cUORxTarget* target );
void timedout( cUOSocket* socket );
Index: pyaccount.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pyaccount.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** pyaccount.cpp 3 Sep 2004 20:37:44 -0000 1.41
--- pyaccount.cpp 25 Sep 2004 02:03:22 -0000 1.42
***************
*** 63,67 ****
static PyTypeObject wpAccountType =
{
! PyObject_HEAD_INIT( &wpAccountType )
0,
"wpaccount",
--- 63,67 ----
static PyTypeObject wpAccountType =
{
! PyObject_HEAD_INIT( 0 )
0,
"wpaccount",
Index: gump.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/gump.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** gump.h 19 Sep 2004 22:13:36 -0000 1.27
--- gump.h 25 Sep 2004 02:03:22 -0000 1.28
***************
*** 132,136 ****
{
// Increase ref-count for argument list
! Py_INCREF( args );
}
--- 132,140 ----
{
// Increase ref-count for argument list
! Py_INCREF(args);
! }
!
! virtual ~cPythonGump() {
! Py_XDECREF(args);
}
***************
*** 156,166 ****
// Create our Argument list
PyObject* p_args = PyTuple_New( 3 );
PyTuple_SetItem( p_args, 0, PyGetCharObject( socket->player() ) );
Py_INCREF(args);
PyTuple_SetItem( p_args, 1, args );
PyTuple_SetItem( p_args, 2, PyGetGumpResponse( choice ) );
! PyEval_CallObject( pFunc, p_args );
reportPythonError( sModule );
}
}
else
--- 160,179 ----
// Create our Argument list
PyObject* p_args = PyTuple_New( 3 );
+
PyTuple_SetItem( p_args, 0, PyGetCharObject( socket->player() ) );
+
Py_INCREF(args);
PyTuple_SetItem( p_args, 1, args );
PyTuple_SetItem( p_args, 2, PyGetGumpResponse( choice ) );
!
! PyObject *result = PyEval_CallObject( pFunc, p_args );
! Py_XDECREF(result);
!
! Py_DECREF(p_args);
!
reportPythonError( sModule );
}
+ Py_XDECREF(pFunc);
+ Py_DECREF(pModule);
}
else
***************
*** 169,174 ****
}
}
-
- Py_DECREF( args );
}
};
--- 182,185 ----
|