diff options
author | jaseg <githubaccount@jaseg.net> | 2017-05-21 13:16:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-21 13:16:32 +0200 |
commit | 627d6a938b08e2ce0da27c58483db4af75a570ad (patch) | |
tree | 6e953ac618bdedc656dcfbd09fc83a76fd9417dc /mpv.py | |
parent | 5ca3a0250cd52d01e949d7f998c49db32480b1ca (diff) | |
parent | b1f81ac56184a172f093b0a640890de9ded405d7 (diff) | |
download | python-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.tar.gz python-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.tar.bz2 python-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.zip |
Merge pull request #28 from Matt-Deacalion/fix-unobserve-runtime-error
Fix `unobserve_property` RuntimeError
Diffstat (limited to 'mpv.py')
-rw-r--r-- | mpv.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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) |