From 63a3bc186afe4afef97f02f5a98d0f3ea0a61b0f Mon Sep 17 00:00:00 2001 From: jmarshallnz Date: Mon, 13 Sep 2010 20:42:54 +0000 Subject: [PATCH] fixed: Plugins "return prematurely" due to race in WaitOnScriptResult. #10136 (cherry picked from commit 252f56984e67529eaebc59d4b6366cbf2c83c64d) git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@33744 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 --- xbmc/FileSystem/PluginDirectory.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xbmc/FileSystem/PluginDirectory.cpp b/xbmc/FileSystem/PluginDirectory.cpp index a92cc83fdcb3c..f5039eb0d7f0c 100644 --- a/xbmc/FileSystem/PluginDirectory.cpp +++ b/xbmc/FileSystem/PluginDirectory.cpp @@ -461,9 +461,12 @@ bool CPluginDirectory::WaitOnScriptResult(const CStdString &scriptPath, const CS #ifdef HAS_PYTHON if (!g_pythonParser.isRunning(g_pythonParser.getScriptId(scriptPath.c_str()))) #endif - { // nope - bail - CLog::Log(LOGDEBUG, " %s - plugin exited prematurely - terminating", __FUNCTION__); - m_success = false; + { // check whether we exited normally + if (WaitForSingleObject(m_fetchComplete, 0) == WAIT_TIMEOUT) + { // python didn't return correctly + CLog::Log(LOGDEBUG, " %s - plugin exited prematurely - terminating", __FUNCTION__); + m_success = false; + } break; }