[guilib] ensure we invalidate items whenever we update properties or tags. fixes...
authorJonathan Marshall <jmarshall@xbmc.org>
Mon, 23 Dec 2013 03:37:05 +0000 (16:37 +1300)
committerJonathan Marshall <jmarshall@xbmc.org>
Mon, 23 Dec 2013 03:40:13 +0000 (16:40 +1300)
xbmc/FileItem.cpp
xbmc/guilib/GUIListItem.cpp

index 73a7949..d983872 100644 (file)
@@ -1477,12 +1477,18 @@ void CFileItem::UpdateInfo(const CFileItem &item, bool replaceLabels /*=true*/)
     if (HasPVRRecordingInfoTag())
       GetPVRRecordingInfoTag()->CopyClientInfo(GetVideoInfoTag());
     SetOverlayImage(ICON_OVERLAY_UNWATCHED, GetVideoInfoTag()->m_playCount > 0);
+    SetInvalid();
   }
   if (item.HasMusicInfoTag())
+  {
     *GetMusicInfoTag() = *item.GetMusicInfoTag();
+    SetInvalid();
+  }
   if (item.HasPictureInfoTag())
+  {
     *GetPictureInfoTag() = *item.GetPictureInfoTag();
-
+    SetInvalid();
+  }
   if (replaceLabels && !item.GetLabel().empty())
     SetLabel(item.GetLabel());
   if (replaceLabels && !item.GetLabel2().empty())
index f00ae61..f104231 100644 (file)
@@ -327,6 +327,7 @@ void CGUIListItem::Archive(CArchive &ar)
       ar >> value;
       m_artFallbacks.insert(make_pair(key, value));
     }
+    SetInvalid();
   }
 }
 void CGUIListItem::Serialize(CVariant &value)
@@ -400,7 +401,17 @@ void CGUIListItem::SetInvalid()
 
 void CGUIListItem::SetProperty(const CStdString &strKey, const CVariant &value)
 {
-  m_mapProperties[strKey] = value;
+  PropertyMap::iterator iter = m_mapProperties.find(strKey);
+  if (iter == m_mapProperties.end())
+  {
+    m_mapProperties.insert(make_pair(strKey, value));
+    SetInvalid();
+  }
+  else if (iter->second != value)
+  {
+    iter->second = value;
+    SetInvalid();
+  }
 }
 
 CVariant CGUIListItem::GetProperty(const CStdString &strKey) const
@@ -425,12 +436,19 @@ void CGUIListItem::ClearProperty(const CStdString &strKey)
 {
   PropertyMap::iterator iter = m_mapProperties.find(strKey);
   if (iter != m_mapProperties.end())
+  {
     m_mapProperties.erase(iter);
+    SetInvalid();
+  }
 }
 
 void CGUIListItem::ClearProperties()
 {
-  m_mapProperties.clear();
+  if (!m_mapProperties.empty())
+  {
+    m_mapProperties.clear();
+    SetInvalid();
+  }
 }
 
 void CGUIListItem::IncrementProperty(const CStdString &strKey, int nVal)