Fix unobserve_property RuntimeError
This commit is contained in:
parent
5ca3a0250c
commit
b1f81ac561
2 changed files with 36 additions and 2 deletions
11
mpv.py
11
mpv.py
|
|
@ -681,8 +681,15 @@ class MPV(object):
|
|||
fmts = self._property_handlers[name]
|
||||
for fmt, handlers in fmts.items():
|
||||
handlers.remove(handler)
|
||||
if not handlers:
|
||||
del fmts[fmt]
|
||||
|
||||
# remove all properties that have no handlers
|
||||
empty_props = [
|
||||
fmt for fmt, handler in fmts.items() if not handler
|
||||
]
|
||||
|
||||
for fmt in empty_props:
|
||||
del fmts[fmt]
|
||||
|
||||
if not fmts:
|
||||
_mpv_unobserve_property(self._event_handle, hash(name)&0xffffffffffffffff)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue