aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIWindowManager.cpp
diff options
context:
space:
mode:
authorelupus <elupus@svn>2010-06-20 01:38:55 +0000
committerelupus <elupus@svn>2010-06-20 01:38:55 +0000
commit628ec5ff2e79ad1f83219733de0280239eae348d (patch)
treea6e80c33fe1338c48554e7af5f08e0c980f0bde0 /guilib/GUIWindowManager.cpp
parente569b94756a79e327dfc0e86c1d7b8a83c12bfcf (diff)
changed: delete python windows from app thread, and only when we are not nested
changed: when a window is removed, it should not be part of the open dialogs list either git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31222 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIWindowManager.cpp')
-rw-r--r--guilib/GUIWindowManager.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/guilib/GUIWindowManager.cpp b/guilib/GUIWindowManager.cpp
index ffc7a00786..1ee6ab7a71 100644
--- a/guilib/GUIWindowManager.cpp
+++ b/guilib/GUIWindowManager.cpp
@@ -39,6 +39,7 @@ CGUIWindowManager::CGUIWindowManager(void)
{
m_pCallback = NULL;
m_bShowOverlay = true;
+ m_iNested = 0;
}
CGUIWindowManager::~CGUIWindowManager(void)
@@ -212,6 +213,14 @@ void CGUIWindowManager::Remove(int id)
WindowMap::iterator it = m_mapWindows.find(id);
if (it != m_mapWindows.end())
{
+ for(vector<CGUIWindow*>::iterator it2 = m_activeDialogs.begin(); it2 != m_activeDialogs.end();)
+ {
+ if(*it2 == it->second)
+ it2 = m_activeDialogs.erase(it2);
+ else
+ it2++;
+ }
+
m_mapWindows.erase(it);
}
else
@@ -231,7 +240,7 @@ void CGUIWindowManager::Delete(int id)
if (pWindow)
{
Remove(id);
- delete pWindow;
+ m_deleteWindows.push_back(pWindow);
}
}
@@ -509,6 +518,19 @@ void CGUIWindowManager::FrameMove()
{
assert(g_application.IsCurrentThread());
CSingleLock lock(g_graphicsContext);
+
+ if(m_iNested == 0)
+ {
+ // delete any windows queued for deletion
+ for(iDialog it = m_deleteWindows.begin(); it != m_deleteWindows.end(); it++)
+ {
+ // Free any window resources
+ (*it)->FreeResources(true);
+ delete *it;
+ }
+ m_deleteWindows.clear();
+ }
+
CGUIWindow* pWindow = GetWindow(GetActiveWindow());
if (pWindow)
pWindow->FrameMove();
@@ -554,12 +576,14 @@ void CGUIWindowManager::Process(bool renderOnly /*= false*/)
{
if (g_application.IsCurrentThread() && m_pCallback)
{
+ m_iNested++;
if (!renderOnly)
{
m_pCallback->Process();
m_pCallback->FrameMove();
}
m_pCallback->Render();
+ m_iNested--;
}
}