Here is a tested quilt patch to be stored in

I could not verify that all leaks are plugged, as the program is
still increasing in size while playing, and I do not know if this
is normal or not.  But the code in question make sense and is from
upstream, so it should at least reduce the amount of memory used. :)

I tested with the patch in place, and the game is working as it should.
I was not able to trigger the slowdown, but do not know if I played
long enough. :)

Happy hacking
Petter Reinholdtsen
Description: Fix small `get_res_icon_path()` widget leak
    `horizons.gui.util.get_res_icon_path()` does the same thing as as
    `horizons.gui.widgets.imagebuton`: aks fife to create an `Icon()` to
    see if it's a valid image path. But other than the `ImageButton`,
    `get_res_icon_path()` did forget to call `hide()` on that `Icon`. So the
    `Icon` stayed alive, even though unused.
    We now call `hide()` on that `Icon`.

Author: MasterofJOKers <>

diff --git a/horizons/gui/ b/horizons/gui/
index a7c13584b..2fb2796b3 100644
--- a/horizons/gui/
+++ b/horizons/gui/
@@ -125,7 +125,7 @@ def get_res_icon_path(res, size=32, greyscale=False, full_path=True):
 		icon_path = icon_path + '{res:03d}.png'.format(res=res)
-		Icon(image=icon_path)
+		Icon(image=icon_path).hide()
 	except fife.NotFound: # ImageManager: image not found, use placeholder or die
 		if res == 'placeholder':
 			raise Exception('Image not found: {icon_path}'.format(icon_path=icon_path))

Reply via email to