Skip to content

Commit 22ecb0a

Browse files
committed
Linux: fix a memory leak introduced with 7e8ae57
1 parent d42d68f commit 22ecb0a

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ History:
22

33
<see Git checking messages for history>
44

5+
3.3.1 2018/xx/xx
6+
- Linux: fix a memory leak introduced with 7e8ae5703f0669f40532c2be917df4328bc3985e
7+
58
3.3.0 2018/09/04
69
- Linux: add an error handler for the XServer to prevent interpreter crash (fix #61)
710
- MSS: fix a ResourceWarning: unclosed file in setup.py

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# built documents.
3030
#
3131
# The short X.Y version.
32-
version = "3.3.0"
32+
version = "3.3.1"
3333

3434
# The full version, including alpha/beta/rc tags.
3535
release = "latest"

mss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from .exception import ScreenShotError
1414
from .factory import mss
1515

16-
__version__ = "3.3.0"
16+
__version__ = "3.3.1"
1717
__author__ = "Mickaël 'Tiger-222' Schoentgen"
1818
__copyright__ = """
1919
Copyright (c) 2013-2018, Mickaël 'Tiger-222' Schoentgen

mss/linux.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,15 @@ class MSS(MSSBase):
148148

149149
def __del__(self):
150150
# type: () -> None
151-
""" Disconnect from X server. """
151+
""" Disconnect from X server and clean-up locals. """
152152

153-
if hasattr(self, "display"):
154-
if hasattr(self.display, "XCloseDisplay"):
155-
self.xlib.XCloseDisplay(self.display)
156-
self.display = None
153+
try:
154+
self.xlib.XCloseDisplay(self.display)
155+
except AttributeError:
156+
pass
157+
158+
for attr in list(vars(self)):
159+
delattr(self, attr)
157160

158161
def __init__(self, display=None):
159162
# type: (bytes) -> None

0 commit comments

Comments
 (0)