aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2016-04-22 09:07:29 +0200
committerxbmc <fernetmenta@online.de>2016-05-01 10:43:47 +0200
commit8f03bb3723ec93f9ba057e782996831cdfb06f93 (patch)
treed1c29e68771f03b5d63babaeb0d1be4bcc0a53da
parent9693db64a521d003dcb58914435db6c0e896b170 (diff)
guilib: only dialogs are allowed to call ProcessRenderLoop
-rw-r--r--xbmc/addons/binary/interfaces/api1/GUI/AddonGUIWindow.cpp2
-rw-r--r--xbmc/dialogs/GUIDialogBusy.cpp2
-rw-r--r--xbmc/dialogs/GUIDialogProgress.cpp2
-rw-r--r--xbmc/filesystem/Directory.cpp38
-rw-r--r--xbmc/filesystem/PluginDirectory.cpp9
-rw-r--r--xbmc/guilib/GUIDialog.cpp5
-rw-r--r--xbmc/guilib/GUIDialog.h2
-rw-r--r--xbmc/guilib/GUIWindowManager.h7
-rw-r--r--xbmc/network/upnp/UPnPPlayer.cpp21
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRBase.cpp32
-rw-r--r--xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp6
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp5
-rw-r--r--xbmc/windows/GUIMediaWindow.h2
13 files changed, 42 insertions, 91 deletions
diff --git a/xbmc/addons/binary/interfaces/api1/GUI/AddonGUIWindow.cpp b/xbmc/addons/binary/interfaces/api1/GUI/AddonGUIWindow.cpp
index 67fd5aa99d..335c62a260 100644
--- a/xbmc/addons/binary/interfaces/api1/GUI/AddonGUIWindow.cpp
+++ b/xbmc/addons/binary/interfaces/api1/GUI/AddonGUIWindow.cpp
@@ -339,7 +339,7 @@ void CGUIAddonWindowDialog::Show_Internal(bool show /* = true */)
m_renderOrder = RENDER_ORDER_DIALOG;
while (m_bRunning && !g_application.m_bStop)
{
- g_windowManager.ProcessRenderLoop();
+ ProcessRenderLoop();
}
}
else // hide
diff --git a/xbmc/dialogs/GUIDialogBusy.cpp b/xbmc/dialogs/GUIDialogBusy.cpp
index 6816b45cc6..8ea5161637 100644
--- a/xbmc/dialogs/GUIDialogBusy.cpp
+++ b/xbmc/dialogs/GUIDialogBusy.cpp
@@ -71,7 +71,7 @@ bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 10
while(!event.WaitMSec(1))
{
- g_windowManager.ProcessRenderLoop(false);
+ dialog->ProcessRenderLoop(false);
if (allowCancel && dialog->IsCanceled())
{
cancelled = true;
diff --git a/xbmc/dialogs/GUIDialogProgress.cpp b/xbmc/dialogs/GUIDialogProgress.cpp
index dc1427150f..af54e49fbf 100644
--- a/xbmc/dialogs/GUIDialogProgress.cpp
+++ b/xbmc/dialogs/GUIDialogProgress.cpp
@@ -85,7 +85,7 @@ void CGUIDialogProgress::Progress()
{
if (m_active)
{
- g_windowManager.ProcessRenderLoop();
+ ProcessRenderLoop();
}
}
diff --git a/xbmc/filesystem/Directory.cpp b/xbmc/filesystem/Directory.cpp
index 0b3e394721..1a713dc0fe 100644
--- a/xbmc/filesystem/Directory.cpp
+++ b/xbmc/filesystem/Directory.cpp
@@ -88,6 +88,11 @@ public:
CJobManager::GetInstance().CancelJob(m_id);
}
+ CEvent& GetEvent()
+ {
+ return m_result->m_event;
+ }
+
bool Wait(unsigned int timeout)
{
return m_result->m_event.WaitMSec(timeout);
@@ -168,36 +173,13 @@ bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CHint
CSingleExit ex(g_graphicsContext);
CGetDirectory get(pDirectory, realURL, url);
- if(!get.Wait(TIME_TO_BUSY_DIALOG))
+
+ if (!CGUIDialogBusy::WaitOnEvent(get.GetEvent(), TIME_TO_BUSY_DIALOG))
{
- CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
- if (dialog)
- {
- dialog->Open();
-
- while(!get.Wait(10))
- {
- CSingleLock lock(g_graphicsContext);
-
- // update progress
- float progress = pDirectory->GetProgress();
- if (progress > 0)
- dialog->SetProgress(progress);
-
- if (dialog->IsCanceled())
- {
- cancel = true;
- pDirectory->CancelDirectory();
- break;
- }
-
- lock.Leave(); // prevent an occasional deadlock on exit
- g_windowManager.ProcessRenderLoop(false);
- }
-
- dialog->Close();
- }
+ cancel = true;
+ pDirectory->CancelDirectory();
}
+
result = get.GetDirectory(items);
}
else
diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp
index e8b63bf616..0987e3aa4e 100644
--- a/xbmc/filesystem/PluginDirectory.cpp
+++ b/xbmc/filesystem/PluginDirectory.cpp
@@ -36,7 +36,6 @@
#include "utils/JobManager.h"
#include "utils/StringUtils.h"
#include "messaging/ApplicationMessenger.h"
-#include "Application.h"
#include "URL.h"
using namespace XFILE;
@@ -457,7 +456,6 @@ bool CPluginDirectory::WaitOnScriptResult(const std::string &scriptPath, int scr
unsigned int startTime = XbmcThreads::SystemClockMillis();
CGUIDialogProgress *progressBar = NULL;
bool cancelled = false;
- bool inMainAppThread = g_application.IsCurrentThread();
CLog::Log(LOGDEBUG, "%s - waiting on the %s (id=%d) plugin...", __FUNCTION__, scriptName.c_str(), scriptId);
while (true)
@@ -513,17 +511,14 @@ bool CPluginDirectory::WaitOnScriptResult(const std::string &scriptPath, int scr
m_cancelled = true;
}
}
- else // if the progressBar exists and we call StartModal or Progress we get the
- // ProcessRenderLoop call anyway.
- if (inMainAppThread)
- g_windowManager.ProcessRenderLoop();
if (!cancelled && m_cancelled)
{
cancelled = true;
startTime = XbmcThreads::SystemClockMillis();
}
- if ((cancelled && XbmcThreads::SystemClockMillis() - startTime > timeToKillScript) || g_application.m_bStop)
+
+ if ((cancelled && XbmcThreads::SystemClockMillis() - startTime > timeToKillScript))
{ // cancel our script
if (scriptId != -1 && CScriptInvocationManager::GetInstance().IsRunning(scriptId))
{
diff --git a/xbmc/guilib/GUIDialog.cpp b/xbmc/guilib/GUIDialog.cpp
index d158af2bbb..24ffe8574f 100644
--- a/xbmc/guilib/GUIDialog.cpp
+++ b/xbmc/guilib/GUIDialog.cpp
@@ -242,3 +242,8 @@ void CGUIDialog::CancelAutoClose(void)
{
m_autoClosing = false;
}
+
+void CGUIDialog::ProcessRenderLoop(bool renderOnly)
+{
+ g_windowManager.ProcessRenderLoop(renderOnly);
+}
diff --git a/xbmc/guilib/GUIDialog.h b/xbmc/guilib/GUIDialog.h
index 06aa718b1a..5142bc7bc1 100644
--- a/xbmc/guilib/GUIDialog.h
+++ b/xbmc/guilib/GUIDialog.h
@@ -76,6 +76,8 @@ protected:
virtual void Open_Internal(bool bProcessRenderLoop, const std::string &param = "");
virtual void OnDeinitWindow(int nextWindowID);
+ void ProcessRenderLoop(bool renderOnly = false);
+
bool m_wasRunning; ///< \brief true if we were running during the last DoProcess()
bool m_autoClosing;
bool m_enableSound;
diff --git a/xbmc/guilib/GUIWindowManager.h b/xbmc/guilib/GUIWindowManager.h
index 76be88d298..27741d8e02 100644
--- a/xbmc/guilib/GUIWindowManager.h
+++ b/xbmc/guilib/GUIWindowManager.h
@@ -40,6 +40,8 @@
#include "utils/GlobalsHandling.h"
class CGUIDialog;
+class CGUIMediaWindow;
+
enum class DialogModalityType;
namespace KODI
@@ -58,6 +60,8 @@ namespace KODI
*/
class CGUIWindowManager : public KODI::MESSAGING::IMessageTarget
{
+ friend CGUIDialog;
+ friend CGUIMediaWindow;
public:
CGUIWindowManager(void);
virtual ~CGUIWindowManager(void);
@@ -140,7 +144,6 @@ public:
bool DestroyWindows();
CGUIWindow* GetWindow(int id) const;
- void ProcessRenderLoop(bool renderOnly = false);
void SetCallback(IWindowManagerCallback& callback);
void DeInitialize();
@@ -204,6 +207,8 @@ private:
*/
void ActivateWindow_Internal(int windowID, const std::vector<std::string> &params, bool swappingWindows, bool force = false);
+ void ProcessRenderLoop(bool renderOnly = false);
+
typedef std::map<int, CGUIWindow *> WindowMap;
WindowMap m_mapWindows;
std::vector <CGUIWindow*> m_vecCustomWindows;
diff --git a/xbmc/network/upnp/UPnPPlayer.cpp b/xbmc/network/upnp/UPnPPlayer.cpp
index 760e250a24..e0adea445d 100644
--- a/xbmc/network/upnp/UPnPPlayer.cpp
+++ b/xbmc/network/upnp/UPnPPlayer.cpp
@@ -193,25 +193,10 @@ static NPT_Result WaitOnEvent(CEvent& event, XbmcThreads::EndTime& timeout, CGUI
if(event.WaitMSec(0))
return NPT_SUCCESS;
- if(dialog == NULL) {
- dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
- dialog->Open();
- }
-
- g_windowManager.ProcessRenderLoop(false);
-
- do {
- if(event.WaitMSec(100))
- return NPT_SUCCESS;
-
- g_windowManager.ProcessRenderLoop(false);
+ if (!CGUIDialogBusy::WaitOnEvent(event))
+ return NPT_FAILURE;
- if(dialog->IsCanceled())
- return NPT_FAILURE;
-
- } while(!timeout.IsTimePast());
-
- return NPT_FAILURE;
+ return NPT_SUCCESS;
}
int CUPnPPlayer::PlayFile(const CFileItem& file, const CPlayerOptions& options, CGUIDialogBusy*& dialog, XbmcThreads::EndTime& timeout)
diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp
index 988f762d33..58fac2fca3 100644
--- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp
@@ -141,37 +141,7 @@ void CGUIWindowPVRBase::OnInitWindow(void)
{
if (!g_PVRManager.IsStarted() || !g_PVRClients->HasCreatedClients())
{
- // wait until the PVR manager has been started
- CGUIDialogProgress* dialog = static_cast<CGUIDialogProgress*>(g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS));
- if (dialog)
- {
- dialog->SetHeading(CVariant{19235});
- dialog->SetText(CVariant{19045});
- dialog->ShowProgressBar(false);
- dialog->Open();
-
- // do not block the gfx context while waiting
- CSingleExit exit(g_graphicsContext);
-
- CEvent event(true);
- while(!event.WaitMSec(1))
- {
- if (g_PVRManager.IsStarted() && g_PVRClients->HasCreatedClients())
- event.Set();
-
- if (dialog->IsCanceled())
- {
- // return to previous window if canceled
- dialog->Close();
- g_windowManager.PreviousWindow();
- return;
- }
-
- g_windowManager.ProcessRenderLoop(false);
- }
-
- dialog->Close();
- }
+ return;
}
{
diff --git a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp
index f4873c2ba7..3ed99ad24c 100644
--- a/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp
+++ b/xbmc/settings/dialogs/GUIDialogAudioDSPManager.cpp
@@ -730,7 +730,7 @@ void CGUIDialogAudioDSPManager::Update()
m_availableItems[iModeType]->Add(pItem);
}
}
- g_windowManager.ProcessRenderLoop(false);
+ ProcessRenderLoop(false);
}
m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
@@ -850,7 +850,7 @@ bool CGUIDialogAudioDSPManager::UpdateDatabase(CGUIDialogBusy* pDlgBusy)
}
}
- g_windowManager.ProcessRenderLoop(false);
+ ProcessRenderLoop(false);
}
for (int iListPtr = 0; iListPtr < m_availableItems[i]->Size(); iListPtr++)
@@ -883,7 +883,7 @@ bool CGUIDialogAudioDSPManager::UpdateDatabase(CGUIDialogBusy* pDlgBusy)
}
}
- g_windowManager.ProcessRenderLoop(false);
+ ProcessRenderLoop(false);
}
}
db.Close();
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index 5360581194..36b3d8163f 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -2002,3 +2002,8 @@ std::string CGUIMediaWindow::RemoveParameterFromPath(const std::string &strDirec
return strDirectory;
}
+
+void CGUIMediaWindow::ProcessRenderLoop(bool renderOnly)
+{
+ g_windowManager.ProcessRenderLoop(renderOnly);
+}
diff --git a/xbmc/windows/GUIMediaWindow.h b/xbmc/windows/GUIMediaWindow.h
index 738fae4ee4..b1eb511624 100644
--- a/xbmc/windows/GUIMediaWindow.h
+++ b/xbmc/windows/GUIMediaWindow.h
@@ -179,6 +179,8 @@ protected:
*/
static std::string RemoveParameterFromPath(const std::string &strDirectory, const std::string &strParameter);
+ void ProcessRenderLoop(bool renderOnly = false);
+
XFILE::CVirtualDirectory m_rootDir;
CGUIViewControl m_viewControl;