[Top][All Lists]

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

[Pingus-Devel] Patch to fix GUIManager memory leaks

From: Aggro
Subject: [Pingus-Devel] Patch to fix GUIManager memory leaks
Date: Wed, 19 Apr 2006 04:34:43 -0700 (PDT)

This is a patch, which should fix some memory leaks
caused by unimplemented behavior in GUIManager::add().

GUIManager:add was supposed to delete given objects by
default or if the second parameter was true. This
feature was never implemented and therefore the memory
was never released.

Another problem was that the function was used
incorrectly. In some locations it was called without
false-parameter, even when the class deleted the
object by itself. This would cause crash at the end of
the program if previously mentioned feature would be

This patch:
1. Implements the delete behavior
2. Adds (most likely) correct parameter for each
function call to prevent crash at the end.
3. Sets the second parameter of the add function not
to have a default value, to prevent misusage in the
future and to make sure developers actually find out
what the parameter should be.
4. Adds extra comment to one function as it was
missing some details I had to find out the hard way.

If there is something wrong with this patch, it will
either cause a memory leak (that was before this patch
anyway) or a crash at the end of the program. So if
you see a crash when closing the game and find a way
to reproduce the crash, report it here. My own tests
didn't show any crashes and I did try to be very
careful with the parameters so this should be a

To fix such a problem, the problematic function call
should be located, and the second parameter should be
changed to have the correct value. True to fix a
memory leak and false to fix a crash.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Attachment: memoryleakfix
Description: 2517563212-memoryleakfix

reply via email to

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