Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24767
Modified Files:
ChangeLog commands.cpp commands.h definitions.cpp log.cpp
pythonscript.cpp scriptmanager.cpp server.cpp territories.cpp
timers.cpp timers.h
Log Message:
Fixed MANY memory leaks.
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.262
retrieving revision 1.263
diff -C2 -d -r1.262 -r1.263
*** commands.cpp 22 Aug 2004 16:34:51 -0000 1.262
--- commands.cpp 25 Sep 2004 02:03:19 -0000 1.263
***************
*** 1533,1536 ****
--- 1533,1544 ----
}
+ // Clear ACLs
+ cCommands::~cCommands() {
+ QMap<QString, cAcl*>::iterator itA( _acls.begin() );
+ for ( ; itA != _acls.end(); ++itA )
+ delete itA.data();
+ _acls.clear();
+ }
+
// Command Table (Keep this at the end)
stCommand cCommands::commands[] =
Index: log.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/log.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** log.cpp 4 Aug 2004 23:17:36 -0000 1.19
--- log.cpp 25 Sep 2004 02:03:19 -0000 1.20
***************
*** 39,42 ****
--- 39,43 ----
cLog::cLog()
{
+ currentday = 0xFF;
}
***************
*** 61,65 ****
if ( !logfile.isOpen() || currentday != today.day() )
{
! logfile.close(); // Just to be sure
QString path = Config::instance()->logPath();
--- 62,68 ----
if ( !logfile.isOpen() || currentday != today.day() )
{
! currentday = today.day();
!
! logfile.close(); // Just to be sure
QString path = Config::instance()->logPath();
***************
*** 86,90 ****
Console::instance()->send( QString( "Couldn't open logfile '%1'\n" ).arg( path + filename ) );
return false;
! }
}
--- 89,93 ----
Console::instance()->send( QString( "Couldn't open logfile '%1'\n" ).arg( path + filename ) );
return false;
! }
}
Index: timers.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** timers.cpp 10 Sep 2004 04:06:26 -0000 1.15
--- timers.cpp 25 Sep 2004 02:03:20 -0000 1.16
***************
*** 523,524 ****
--- 523,532 ----
}
+ cTimers::~cTimers() {
+ // Clear all teffects
+ std::vector<cTimer*>::iterator it;
+ for (it = teffects.begin(); it != teffects.end(); ++it) {
+ delete *it;
+ }
+ teffects.clear();
+ }
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** ChangeLog 24 Sep 2004 04:47:22 -0000 1.75
--- ChangeLog 25 Sep 2004 02:03:19 -0000 1.76
***************
*** 50,53 ****
--- 50,55 ----
- Fixed translation support.
- Added ability to disable translation support during compile time thru configure.py
+ - Fixed a log rotation bug related to uninitialized variables (valgrind.kde.org)
+ - Fixed memory leaks in Territories, ACLs and PythonScripts. (valgrind.kde.org)
Wolfpack 12.9.10 Beta (10. September 2004)
Index: definitions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/definitions.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** definitions.cpp 3 Sep 2004 15:43:50 -0000 1.18
--- definitions.cpp 25 Sep 2004 02:03:19 -0000 1.19
***************
*** 114,117 ****
--- 114,125 ----
this->filename = filename;
};
+
+ virtual ~cXmlHandler() {
+ while ( stack.count() > 1 )
+ stack.pop(); // The parent node should take care of deleting the children
+
+ if ( stack.count() == 1 )
+ delete stack.pop();
+ }
void setDocumentLocator( QXmlLocator* locator )
Index: scriptmanager.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/scriptmanager.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** scriptmanager.cpp 1 Sep 2004 20:03:52 -0000 1.26
--- scriptmanager.cpp 25 Sep 2004 02:03:20 -0000 1.27
***************
*** 85,90 ****
// Stop + Restart Python
! stopPython();
! startPython( qApp->argc(), qApp->argv() );
load();
--- 85,92 ----
// Stop + Restart Python
! //stopPython();
! //startPython( qApp->argc(), qApp->argv() );
! PythonEngine::instance()->unload();
! PythonEngine::instance()->load();
load();
***************
*** 106,119 ****
cUOSocket::clearPacketHandlers();
- cScriptManager::iterator it;
-
- for ( it = scripts.begin(); it != scripts.end(); ++it )
- {
- it.data()->unload();
- delete it.data();
- }
-
- scripts.clear();
-
for ( unsigned int i = 0; i < EVENT_COUNT; ++i )
{
--- 108,111 ----
***************
*** 129,132 ****
--- 121,135 ----
commandhooks.clear();
+
+ cScriptManager::iterator it;
+
+ for ( it = scripts.begin(); it != scripts.end(); ++it )
+ {
+ it.data()->unload();
+ delete it.data();
+ }
+
+ scripts.clear();
+
cComponent::unload();
}
Index: timers.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timers.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** timers.h 10 Sep 2004 04:06:26 -0000 1.7
--- timers.h 25 Sep 2004 02:03:20 -0000 1.8
***************
*** 180,183 ****
--- 180,185 ----
public:
cTimers();
+ ~cTimers();
+
std::vector<cTimer*> teffects;
Index: commands.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** commands.h 2 Jun 2004 15:04:04 -0000 1.22
--- commands.h 25 Sep 2004 02:03:19 -0000 1.23
***************
*** 76,79 ****
--- 76,81 ----
}
+ ~cCommands();
+
// Privlevel System
void loadACLs( void );
Index: territories.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/territories.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** territories.cpp 29 Aug 2004 20:40:50 -0000 1.54
--- territories.cpp 25 Sep 2004 02:03:20 -0000 1.55
***************
*** 302,305 ****
--- 302,308 ----
void cTerritories::unload()
{
+ // Delete old regions
+
+
topregions.clear();
cComponent::unload();
***************
*** 323,326 ****
--- 326,330 ----
territory->rectangles().append( rect );
topregions[i].append( territory );
+ topregions[i].setAutoDelete( true ); // set to auto delete
}
}
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** pythonscript.cpp 22 Sep 2004 05:34:47 -0000 1.49
--- pythonscript.cpp 25 Sep 2004 02:03:19 -0000 1.50
***************
*** 562,566 ****
if ( events[i] )
{
! Py_XDECREF( events[i] );
events[i] = 0;
}
--- 562,566 ----
if ( events[i] )
{
! Py_DECREF( events[i] );
events[i] = 0;
}
***************
*** 666,669 ****
--- 666,671 ----
reportPythonError( name_ );
}
+
+ Py_XDECREF(event);
}
Index: server.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/server.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** server.cpp 24 Sep 2004 15:19:06 -0000 1.27
--- server.cpp 25 Sep 2004 02:03:20 -0000 1.28
***************
*** 110,113 ****
--- 110,115 ----
unsigned int time;
QValueVector<cAction*> actionQueue;
+ QApplication *app;
+
Private() : running( true ), state( STARTUP ), secure( true ), time( 0 )
{
***************
*** 204,207 ****
--- 206,210 ----
d = new Private;
+ d->app = 0;
// Register Components
***************
*** 231,234 ****
--- 234,238 ----
cServer::~cServer()
{
+ delete d->app;
delete d;
}
***************
*** 260,264 ****
setState( STARTUP );
! new QApplication ( argc, argv, false );
// Load wolfpack.xml
--- 264,268 ----
setState( STARTUP );
! d->app = new QApplication ( argc, argv, false );
// Load wolfpack.xml
|