Ensure icon resource stream is closed
parent
79e4f603ae
commit
178aa35e7e
|
@ -236,7 +236,7 @@ class Notifier(object):
|
||||||
|
|
||||||
def show_status_icon(self):
|
def show_status_icon(self):
|
||||||
loader = GdkPixbuf.PixbufLoader()
|
loader = GdkPixbuf.PixbufLoader()
|
||||||
img = pkg_resources.resource_stream('mpdnotify', 'mpd-logo.png')
|
with pkg_resources.resource_stream('mpdnotify', 'mpd-logo.png') as img:
|
||||||
with contextlib.closing(loader):
|
with contextlib.closing(loader):
|
||||||
for d in iter(lambda: img.read(1), b''):
|
for d in iter(lambda: img.read(1), b''):
|
||||||
loader.write(d)
|
loader.write(d)
|
||||||
|
|
Loading…
Reference in New Issue