changed: Ensure CGUIWindow::Initialize returns false if the window manager isn't...
authorjmarshallnz <jmarshallnz@svn>
Mon, 13 Dec 2010 19:44:12 +0000 (19:44 +0000)
committerjmarshallnz <jmarshallnz@svn>
Mon, 13 Dec 2010 19:44:12 +0000 (19:44 +0000)
(cherry picked from commit 783ee034e3985868d9a8fecc38c137867d24aa8a)

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@35631 568bbfeb-2a22-0410-94d2-cc84cf5bfa90

guilib/GUIDialog.cpp
guilib/GUIWindow.cpp
guilib/GUIWindowManager.cpp
guilib/GUIWindowManager.h

index b1736db..4af7c91 100644 (file)
@@ -145,6 +145,9 @@ void CGUIDialog::DoModal_Internal(int iWindowID /*= WINDOW_INVALID */, const CSt
   //maybe we should have a critical section per window instead??
   CSingleLock lock(g_graphicsContext);
 
+  if (!g_windowManager.Initialized())
+    return; // don't do anything
+
   m_dialogClosing = false;
   m_bModal = true;
   // set running before it's added to the window manager, else the auto-show code
@@ -184,6 +187,9 @@ void CGUIDialog::Show_Internal()
 
   if (m_bRunning && !m_dialogClosing && !IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) return;
 
+  if (!g_windowManager.Initialized())
+    return; // don't do anything
+
   m_bModal = false;
 
   // set running before it's added to the window manager, else the auto-show code
index 6b7c0fa..7576398 100644 (file)
@@ -650,6 +650,8 @@ void CGUIWindow::ClearAll()
 
 bool CGUIWindow::Initialize()
 {
+  if (!g_windowManager.Initialized())
+    return false;     // can't load if we have no skin yet
   return Load(GetProperty("xmlfile"));
 }
 
index 354aeb5..20d4b57 100644 (file)
@@ -40,6 +40,7 @@ CGUIWindowManager::CGUIWindowManager(void)
   m_pCallback = NULL;
   m_bShowOverlay = true;
   m_iNested = 0;
+  m_initialized = false;
 }
 
 CGUIWindowManager::~CGUIWindowManager(void)
@@ -49,6 +50,7 @@ CGUIWindowManager::~CGUIWindowManager(void)
 void CGUIWindowManager::Initialize()
 {
   LoadNotOnDemandWindows();
+  m_initialized = true;
 }
 
 bool CGUIWindowManager::SendMessage(int message, int senderID, int destID, int param1, int param2)
@@ -626,6 +628,8 @@ void CGUIWindowManager::DeInitialize()
   // clear our vectors of windows
   m_vecCustomWindows.clear();
   m_activeDialogs.clear();
+
+  m_initialized = false;
 }
 
 /// \brief Route to a window
index e68af05..7597d9c 100644 (file)
@@ -78,7 +78,14 @@ public:
    on screen. It should only be called from the application thread.
    */
   void FrameMove();
-  
+
+  /*! \brief Return whether the window manager is initialized.
+   The window manager is initialized on skin load - if the skin isn't yet loaded,
+   no windows should be able to be initialized.
+   \return true if the window manager is initialized, false otherwise.
+   */
+  bool Initialized() const { return m_initialized; };
+
   CGUIWindow* GetWindow(int id) const;
   void Process(bool renderOnly = false);
   void SetCallback(IWindowManagerCallback& callback);
@@ -140,6 +147,7 @@ private:
 
   bool m_bShowOverlay;
   int  m_iNested;
+  bool m_initialized;
 };
 
 /*!