[fife] 01/02: Add 1000-icon-mem-leak.patch and fix a memory leak.
Markus Koschany
apo at moszumanska.debian.org
Mon Aug 21 07:45:00 UTC 2017
This is an automated email from the git hooks/post-receive script.
apo pushed a commit to branch stretch
in repository fife.
commit 8b357f766312add59ec0dbd5962e61bc1c5a811c
Author: Markus Koschany <apo at debian.org>
Date: Mon Aug 21 07:56:33 2017 +0200
Add 1000-icon-mem-leak.patch and fix a memory leak.
Thanks: Petter Reinholdtsen for the report and testing and LinuxDonald for the patch.
Closes: #871782
---
debian/patches/1000-icon-mem-leak.patch | 42 +++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 43 insertions(+)
diff --git a/debian/patches/1000-icon-mem-leak.patch b/debian/patches/1000-icon-mem-leak.patch
new file mode 100644
index 0000000..acced84
--- /dev/null
+++ b/debian/patches/1000-icon-mem-leak.patch
@@ -0,0 +1,42 @@
+Description: pychan: Remove Icon from manager on source load failure
+
+ When creating an `Icon` with an invalid file path, the `Icon` object
+ first calls its parent's `__init__()` and then trys to load the image
+ source. Loading the image might end up in e.g. `fife.NotFound`, but the
+ parent's `__init__()` already added the new `Icon` instance to the
+ manager. So while the code creating the `Icon` will never see an
+ instance of it and can never call `hide()` to remove it, the manager
+ still thinks that there's an instance available.
+
+ This commit changes to code to remove the `Icon` from the manager for
+ any occuring exception and then re-raise the exception.
+
+Origin: https://github.com/fifengine/fifengine/commit/2efebb3a0940e2570d2e7abeb54957dcb6f110ea
+Author: MasterofJOKers <joker at someserver.de>
+Bug-Debian: https://bugs.debian.org/871782
+
+diff --git a/engine/python/fife/extensions/pychan/widgets/icon.py b/engine/python/fife/extensions/pychan/widgets/icon.py
+index 9d5daf3b..b94a6a58 100644
+--- a/engine/python/fife/extensions/pychan/widgets/icon.py
++++ b/engine/python/fife/extensions/pychan/widgets/icon.py
+@@ -26,6 +26,7 @@ from fife import fifechan
+ from fife.extensions.pychan.attrs import Attr, BoolAttr
+ from fife.extensions.pychan.properties import ImageProperty
+
++from common import get_manager
+ from widget import Widget
+
+
+@@ -88,7 +89,11 @@ class Icon(Widget):
+
+ if scale is not None: self.scale = scale
+
+- self.image = image
++ try:
++ self.image = image
++ except Exception:
++ get_manager().removeWidget(self)
++ raise
+
+ #if the size parameter is specified set it (again) to override
+ #the icons size.
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..9cb97e3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+1000-icon-mem-leak.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/fife.git
More information about the Pkg-games-commits
mailing list