pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3219 - trunk/pingus/src/input


From: jsalmon3
Subject: [Pingus-CVS] r3219 - trunk/pingus/src/input
Date: Sat, 22 Sep 2007 04:03:18 +0200

Author: jsalmon3
Date: 2007-09-22 04:03:10 +0200 (Sat, 22 Sep 2007)
New Revision: 3219

Modified:
   trunk/pingus/src/input/controller.cpp
   trunk/pingus/src/input/controller.hpp
Log:
Fixed memory leak

Modified: trunk/pingus/src/input/controller.cpp
===================================================================
--- trunk/pingus/src/input/controller.cpp       2007-09-22 02:00:15 UTC (rev 
3218)
+++ trunk/pingus/src/input/controller.cpp       2007-09-22 02:03:10 UTC (rev 
3219)
@@ -66,6 +66,30 @@
     }
 }
 
+Controller::~Controller()
+{
+  for(std::vector<ControllerButton*>::iterator i = buttons.begin(); i != 
buttons.end(); ++i)
+    {
+      delete *i;
+    }
+  for(std::vector<ControllerAxis*>::iterator i = axes.begin(); i != 
axes.end(); ++i)
+    {
+      delete *i;
+    }
+  for(std::vector<ControllerPointer*>::iterator i = pointers.begin(); i != 
pointers.end(); ++i)
+    {
+      delete *i;
+    }
+  for(std::vector<ControllerScroller*>::iterator i = scrollers.begin(); i != 
scrollers.end(); ++i)
+    {
+      delete *i;
+    }
+  for(std::vector<ControllerKeyboard*>::iterator i = keyboards.begin(); i != 
keyboards.end(); ++i)
+    {
+      delete *i;
+    }
+}
+
 ControllerScroller*
 Controller::get_scroller(int id) 
 {

Modified: trunk/pingus/src/input/controller.hpp
===================================================================
--- trunk/pingus/src/input/controller.hpp       2007-09-22 02:00:15 UTC (rev 
3218)
+++ trunk/pingus/src/input/controller.hpp       2007-09-22 02:03:10 UTC (rev 
3219)
@@ -54,7 +54,7 @@
   std::vector<Event> poll_events();
 
   Controller(const ControllerDescription& desc);
-  ~Controller() {}
+  ~Controller();
   
   ControllerAxis*     get_axis(int id);
   ControllerButton*   get_button(int id);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]