xbmc: add python callback error handling fix (https://github.com/xbmc/xbmc/pull/189)

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-06-10 16:12:38 +02:00
parent d023dde2fc
commit 743a0c84b6

View File

@ -0,0 +1,39 @@
From 4bcbf6a4a0fde61c18d8de66a8d05aa441ab6fc9 Mon Sep 17 00:00:00 2001
From: Jim Carroll <thecarrolls@jiminger.com>
Date: Thu, 9 Jun 2011 14:34:24 -0400
Subject: [PATCH] Allow python error information from callbacks to make it to
the log.
---
xbmc/lib/libPython/xbmcmodule/pyutil.cpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/xbmc/lib/libPython/xbmcmodule/pyutil.cpp b/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
index 9a98cdf..041f332 100644
--- a/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/pyutil.cpp
@@ -28,6 +28,7 @@
#include "CriticalSection.h"
#include "SingleLock.h"
#include "Application.h"
+#include "utils/log.h"
using namespace std;
@@ -203,6 +204,13 @@ void _PyXBMC_MakePendingCalls()
lock.Leave();
if (p.func)
p.func(p.args);
+
+ if (PyErr_Occurred())
+ {
+ CLog::Log(LOGERROR,"Exception in python callback");
+ PyErr_Print();
+ }
+
//(*((*iter).first))((*iter).second);
lock.Enter();
iter = g_callQueue.begin();
--
1.7.5.4