Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

pvr: fix bug that prevented the pvrmanager from starting up

  • Loading branch information...
commit 1f2654c500993b573ec339ed18ba6effd3ba3587 1 parent 0813fe0
Lars Op den Kamp authored

Showing 1 changed file with 20 additions and 8 deletions. Show diff stats Hide diff stats

  1. 28  xbmc/pvr/PVRManager.cpp
28  xbmc/pvr/PVRManager.cpp
@@ -135,7 +135,7 @@ void CPVRManager::Start()
135 135
   Create();
136 136
   SetName("XBMC PVRManager");
137 137
   SetPriority(-1);
138  
-  CLog::Log(LOGNOTICE, "PVRManager - started with %u active clients", m_clients.size());
  138
+  CLog::Log(LOGNOTICE, "PVRManager - starting up");
139 139
 }
140 140
 
141 141
 void CPVRManager::Stop()
@@ -160,7 +160,7 @@ bool CPVRManager::TryLoadClients(int iMaxTime /* = 0 */)
160 160
   CAddonMgr::Get().RegisterAddonMgrCallback(ADDON_PVRDLL, this);
161 161
   CDateTime start = CDateTime::GetCurrentDateTime();
162 162
 
163  
-  while (!m_bAllClientsLoaded && m_clients.size() > 0)
  163
+  while (!m_bAllClientsLoaded)
164 164
   {
165 165
     /* try to load clients */
166 166
     LoadClients();
@@ -177,11 +177,15 @@ bool CPVRManager::TryLoadClients(int iMaxTime /* = 0 */)
177 177
         break;
178 178
     }
179 179
 
  180
+    /* break if there are no activated clients */
  181
+    if (m_clients.empty())
  182
+      break;
  183
+
180 184
     Sleep(250);
181 185
   }
182 186
 
183 187
   CLog::Log(LOG_DEBUG, "PVRManager - %s - %s",
184  
-      __FUNCTION__, m_bAllClientsLoaded ? "all clients loaded" : "couldn't load all clients. will keep trying in a separate thread.");
  188
+      __FUNCTION__, m_bAllClientsLoaded && !m_clients.empty() ? "all clients loaded" : "couldn't load all clients. will keep trying in a separate thread.");
185 189
   return m_bAllClientsLoaded;
186 190
 }
187 191
 
@@ -197,7 +201,10 @@ bool CPVRManager::LoadClients(void)
197 201
 
198 202
   /* load and initialise the clients */
199 203
   if (!m_database.Open())
  204
+  {
  205
+    CLog::Log(LOGERROR, "PVRManager - %s - cannot open the database", __FUNCTION__);
200 206
     return false;
  207
+  }
201 208
 
202 209
   m_bAllClientsLoaded = true;
203 210
   for (unsigned iClientPtr = 0; iClientPtr < addons.size(); iClientPtr++)
@@ -461,7 +468,7 @@ bool CPVRManager::DisableIfNoClients(void)
461 468
 {
462 469
   bool bReturn = false;
463 470
 
464  
-  if (m_clients.size() == 0)
  471
+  if (m_clients.empty())
465 472
   {
466 473
     g_guiSettings.SetBool("pvrmanager.enabled", false);
467 474
     CLog::Log(LOGNOTICE,"PVRManager - no clients enabled. pvrmanager disabled.");
@@ -475,14 +482,12 @@ void CPVRManager::Process()
475 482
 {
476 483
   while (!HasActiveClients())
477 484
   {
478  
-    /* check if the (still) are any enabled addons */
479  
-    if (DisableIfNoClients())
480  
-      return;
481  
-
482 485
     TryLoadClients(1);
483 486
 
484 487
     if (HasActiveClients())
485 488
     {
  489
+      CLog::Log(LOGDEBUG, "PVRManager - %s - active clients found. continue to start", __FUNCTION__);
  490
+
486 491
       /* load all channels and groups */
487 492
       m_channelGroups->Load();
488 493
 
@@ -495,6 +500,13 @@ void CPVRManager::Process()
495 500
       /* start the EPG thread */
496 501
       m_epg->Start();
497 502
     }
  503
+
  504
+    /* check if the (still) are any enabled addons */
  505
+    if (DisableIfNoClients())
  506
+    {
  507
+      CLog::Log(LOGDEBUG, "PVRManager - %s - no clients could be found. aborting startup", __FUNCTION__);
  508
+      return;
  509
+    }
498 510
   }
499 511
 
500 512
   m_bLoaded = true;

0 notes on commit 1f2654c

Please sign in to comment.
Something went wrong with that request. Please try again.