diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2012-03-20 13:24:19 -0700 |
---|---|---|
committer | jmarshallnz <jcmarsha@gmail.com> | 2012-03-20 13:24:19 -0700 |
commit | bdec5c43ad7741350f1e7f0fe929e8e99fda9f4d (patch) | |
tree | 14ca960521669ba5044968459c5fd57c60395054 | |
parent | 7fad8083195ed77568c9a800084d698978c1b28e (diff) | |
parent | ed9cc6cc920f61cf1070394d356fc4488fcf599d (diff) |
Merge pull request #790 from jimfcarroll/fix-12581
handling deadlock around using the dialog progress from python.
-rw-r--r-- | xbmc/interfaces/python/xbmcmodule/dialog.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/xbmc/interfaces/python/xbmcmodule/dialog.cpp b/xbmc/interfaces/python/xbmcmodule/dialog.cpp index 13f94d026b..fb2aed8ba3 100644 --- a/xbmc/interfaces/python/xbmcmodule/dialog.cpp +++ b/xbmc/interfaces/python/xbmcmodule/dialog.cpp @@ -469,18 +469,28 @@ namespace PYXBMC return NULL; } - PyXBMCGUILock(); - CGUIDialogProgress* pDialog= (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - if (PyXBMCWindowIsNull(pDialog)) return NULL; - ((DialogProgress*)self)->dlg = pDialog; + CGUIDialogProgress* pDialog; + { + CPyThreadState releaseGil; + CSingleLock glock(g_graphicsContext); - pDialog->SetHeading(utf8Line[0]); + pDialog= (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); + if (!pDialog) + { + glock.Leave(); + releaseGil.Restore(); + PyErr_SetString(PyExc_SystemError, "Error: Window is NULL, this is not possible :-)"); + return NULL; + } + ((DialogProgress*)self)->dlg = pDialog; - for (int i = 1; i < 4; i++) - pDialog->SetLine(i - 1,utf8Line[i]); + pDialog->SetHeading(utf8Line[0]); - PyXBMCGUIUnlock(); - pDialog->StartModal(); + for (int i = 1; i < 4; i++) + pDialog->SetLine(i - 1,utf8Line[i]); + + pDialog->StartModal(); + } Py_INCREF(Py_None); return Py_None; |