Skip to content

Commit 616a754

Browse files
committed
Fix crash caused by invalid poll descriptors
1 parent b7a6572 commit 616a754

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mopidy_alsamixer/mixer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import math
33
import random
44
import select
5+
import struct
56
import time
67

78
import alsaaudio
@@ -226,10 +227,16 @@ def __init__(self, mixer, parent):
226227
self._mixer = mixer
227228
self._parent = parent
228229

230+
# FIXME: Remove when a new version of pyalsaaudio is released
231+
# See https://github.com/larsimmisch/pyalsaaudio/pull/108
232+
def check_fd(fd):
233+
return fd != -1 and fd != struct.unpack("I", b"\xFF\xFF\xFF\xFF")[0]
234+
229235
super().__init__(
230236
fds=tuple(
231237
(fd, event_mask | select.EPOLLET)
232238
for (fd, event_mask) in self._mixer.polldescriptors()
239+
if check_fd(fd)
233240
)
234241
)
235242

0 commit comments

Comments
 (0)