Permalink
Browse files

Merge pull request #80 from ulion/handle_greater_than_zero

Fix bug related to valid handles. 

plugin.finish should be called for handles >= 0.
  • Loading branch information...
2 parents 63dc3a7 + 92c3ec1 commit 9b889eb21d537f8e47d7a727b4a202c3406d2d9a @jbeluch committed Jan 15, 2013
Showing with 6 additions and 4 deletions.
  1. +6 −4 xbmcswift2/plugin.py
View
@@ -294,11 +294,13 @@ def _dispatch(self, path):
path, view_func.__name__)
listitems = view_func(**items)
- # TODO: Verify the main UI handle is always 0, this check exists so
- # we don't erroneously call endOfDirectory for alternate
- # threads
+ # XXX: The UI Container listing call to plugin or the resolving
+ # url call always has a handle greater or equals 0. RunPlugin()
+ # call using a handle -1. we only auto-call endOfDirectory for
+ # the UI Container listing call. and set_resolve_url() also
+ # set the _end_of_directory flag so we do not call finish() for it.
# Allow the returning of bare dictionaries so we can cache view
- if not self._end_of_directory and self.handle == 0:
+ if not self._end_of_directory and self.handle >= 0:
listitems = self.finish(listitems)
return listitems

0 comments on commit 9b889eb

Please sign in to comment.