diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 7f6caa239a6f2..c18c3b523ac69 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -3193,14 +3193,13 @@ void CVideoDatabase::DeleteMovie(int idMovie, bool bKeepId /* = false */) // the ancilliary tables are still purged if (!bKeepId) { - strSQL=PrepareSQL("delete from movie where idMovie=%i", idMovie); - m_pDS->exec(strSQL.c_str()); - - // TODO: Why are we invalidating paths here? int idFile = GetDbId(PrepareSQL("SELECT idFile FROM movie WHERE idMovie=%i", idMovie)); std::string path = GetSingleValue(PrepareSQL("SELECT strPath FROM path JOIN files ON files.idPath=path.idPath WHERE files.idFile=%i", idFile)); if (!path.empty()) InvalidatePathHash(path); + + strSQL=PrepareSQL("delete from movie where idMovie=%i", idMovie); + m_pDS->exec(strSQL.c_str()); } //TODO: move this below CommitTransaction() once UPnP doesn't rely on this anymore @@ -3403,14 +3402,13 @@ void CVideoDatabase::DeleteMusicVideo(int idMVideo, bool bKeepId /* = false */) // the ancilliary tables are still purged if (!bKeepId) { - strSQL=PrepareSQL("delete from musicvideo where idMVideo=%i", idMVideo); - m_pDS->exec(strSQL.c_str()); - - // TODO: Why are we invalidating paths here? int idFile = GetDbId(PrepareSQL("SELECT idFile FROM musicvideo WHERE idMVideo=%i", idMVideo)); std::string path = GetSingleValue(PrepareSQL("SELECT strPath FROM path JOIN files ON files.idPath=path.idPath WHERE files.idFile=%i", idFile)); if (!path.empty()) InvalidatePathHash(path); + + strSQL=PrepareSQL("delete from musicvideo where idMVideo=%i", idMVideo); + m_pDS->exec(strSQL.c_str()); } //TODO: move this below CommitTransaction() once UPnP doesn't rely on this anymore