Re: Patch attempting to take care of some memory errors
Håkan Kvist <[email protected]> Sun, 25 Feb 2007 22:45:00 +0100
| Newsgroups | gmane.network.centericq |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Feb 25, 2007 at 10:41:08PM +0100, Håkan Kvist wrote: > On Sat, Feb 24, 2007 at 04:15:29PM +0100, Håkan Kvist wrote: > > And here comes the patch. > > > > Håkan > > > > And here is a small addition to the previous patch. > > David found an error in my patch (you shouldn't do delete on a > void*), and have allready reverted that particular change in the repositry. > > Attatched patch registers a callback for objects of type icqcontact, > so that elemnts of this type gets properly deallocated (wtih delete). It's a bit tricky to attatch files late on a sunday evening. Håkan _______________________________________________ Cicq mailing list Cicq-xGejAJT2w6wWP6gT/[email protected] http://mailman.linuxpl.org/mailman/listinfo/cicq Questions? Check the FAQ first: http://centericq.de/faq/
centericq_mem2.patch
(text/plain, 474 B)
diff --git a/src/icqcontacts.cc b/src/icqcontacts.cc
index ec6f588..177ac4e 100644
--- a/src/icqcontacts.cc
+++ b/src/icqcontacts.cc
@@ -28,7 +28,15 @@
#include "icqgroups.h"
#include "abstracthook.h"
+
+/* Function used to delete icqcontact when removed from the list */
+static void deletecontact(void *contact){
+ icqcontact *c = (icqcontact *)contact;
+ delete c;
+}
+
icqcontacts::icqcontacts() {
+ freeitem = deletecontact;
}
icqcontacts::~icqcontacts() {