Merge pull request #2253 from ulion/dispatch_gui_thread_message_in_order_fix

Refactor CGUIWindowManager::DispatchThreadMessages() to be a solid thread message dispatch and process method.
Fix race conditions after starting flag reset,
make sure play state callbacks are called and only called once.
[Fix] Use shared pointer for the player in CApplication, fix double PlayFile call crash.