xbmc/xbmc — pull request #1221 by garbear (2012-07-26 04:06:07+00:00)
Title: Fixed poor synchronization in XBPyThread::stop()

This fixes XBPyThread::stop() waiting on a event in the application thread, which precludes the event from getting triggered if a Python script relies on the messaging system to close itself (such as calling the .close() function on an open dialog)

An alternative could be not ever calling ::stop() in the app thread. I don't know how feasible this is.

My strategy for handling messages comes from
https://github.com/xbmc/xbmc/blob/master/xbmc/cores/dvdplayer/DVDPlayer.cpp#L461
https://github.com/xbmc/xbmc/blob/master/xbmc/filesystem/Directory.cpp#L170
https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/GUIDialog.cpp#L176

and I've learned that just because it's done throughout the code base doesn't make it correct, consistent or complete. Always open to being pointed in the right direction :)