Repository: xbmc/xbmc
File: xbmc/utils/SaveFileStateJob.cpp (C++)

Code before:
              videodatabase.AddBookMarkToFile(progressTrackingFile, bookmark, CBookmark::RESUME);
            if (item.HasVideoInfoTag())
              item.GetVideoInfoTag()->SetResumePoint(bookmark);

            // UPnP announce resume point changes to clients
            // however not if playcount is modified as that already announces
            if (item.HasVideoInfoTag() && !updatePlayCount)
            {
              CVariant data;
              data["id"] = item.GetVideoInfoTag()->m_iDbId;
              data["type"] = item.GetVideoInfoTag()->m_type;
              CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary,
                                                                 "OnUpdate", data);
            }

            updateListing = true;
          }
        }

        //! @todo videoDBSuccess will always be true as not updated yet for play count and bookmark changes
        if (videoDbSuccess)
          videodatabase.CommitTransaction();
        else
          videodatabase.RollbackTransaction();
        videodatabase.BeginTransaction();

        if (item.HasVideoInfoTag() && item.GetVideoInfoTag()->HasStreamDetails() &&
            !item.IsLiveTV())
        {
          CFileItem dbItem(item);

          // Check whether the item's db streamdetails need updating
          if (!videodatabase.GetStreamDetails(dbItem) ||
              dbItem.GetVideoInfoTag()->m_streamDetails != item.GetVideoInfoTag()->m_streamDetails)
          {
            videoDbSuccess = videodatabase.SetStreamDetailsForFile(
                item.GetVideoInfoTag()->m_streamDetails, progressTrackingFile);
            updateListing = !videoDbSuccess;
          }
        }

        if (videoDbSuccess)
          videodatabase.CommitTransaction();
        else
          videodatabase.RollbackTransaction();
        videodatabase.BeginTransaction();
        videoDbSuccess = true;

        // See if fileId needs updating
        if (item.HasVideoInfoTag() && URIUtils::IsBluray(item.GetDynPath()))
        {

Review comment (suggestion):
I'd only include the CommitTransaction at this time, with a todo to properly handle errors, as you did.

Code after:
              videodatabase.AddBookMarkToFile(progressTrackingFile, bookmark, CBookmark::RESUME);
            if (item.HasVideoInfoTag())
              item.GetVideoInfoTag()->SetResumePoint(bookmark);

            // UPnP announce resume point changes to clients
            // however not if playcount is modified as that already announces
            if (item.HasVideoInfoTag() && !updatePlayCount)
            {
              CVariant data;
              data["id"] = item.GetVideoInfoTag()->m_iDbId;
              data["type"] = item.GetVideoInfoTag()->m_type;
              CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary,
                                                                 "OnUpdate", data);
            }

            updateListing = true;
          }
        }

        //! @todo videoDBSuccess will always be true as not updated yet for play count and bookmark changes
        if (videoDbSuccess)
          videodatabase.CommitTransaction();
        else
          videodatabase.RollbackTransaction();
        videodatabase.BeginTransaction();

        if (item.HasVideoInfoTag() && item.GetVideoInfoTag()->HasStreamDetails() &&
            !item.IsLiveTV())
        {
          CFileItem dbItem(item);

          // Check whether the item's db streamdetails need updating
          if (!videodatabase.GetStreamDetails(dbItem) ||
              dbItem.GetVideoInfoTag()->m_streamDetails != item.GetVideoInfoTag()->m_streamDetails)
          {
            videoDbSuccess = videodatabase.SetStreamDetailsForFile(
                item.GetVideoInfoTag()->m_streamDetails, progressTrackingFile);
            updateListing = !videoDbSuccess;
          }
        }

        if (videoDbSuccess)
          videodatabase.CommitTransaction();
        else
          videodatabase.RollbackTransaction();
        videodatabase.BeginTransaction();
        videoDbSuccess = true;

        // See if idFile needs updating
        if (item.HasVideoInfoTag() && URIUtils::IsBlurayPath(item.GetDynPath()))
        {