Adjust the count of SUB_SOURCE_SUBS when updating set_of_subtitles.
authorib <ib@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 12 Apr 2018 11:29:17 +0000 (11:29 +0000)
committerib <ib@b3059339-0415-0410-9bf9-f77b7e298cf2>
Thu, 12 Apr 2018 11:29:17 +0000 (11:29 +0000)
When deleting or adding a subtitle, update not only set_of_sub_size,
but sub_counts[SUB_SOURCE_SUBS] as well. The count will be otherwise
useless.

git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@38066 b3059339-0415-0410-9bf9-f77b7e298cf2

mplayer.c

index f73ff06..fe45c39 100644 (file)
--- a/mplayer.c
+++ b/mplayer.c
@@ -1135,6 +1135,7 @@ void update_set_of_subtitles(void)
             set_of_subtitles[i - 1] = set_of_subtitles[i];
         set_of_subtitles[mpctx->set_of_sub_size - 1] = NULL;
         --mpctx->set_of_sub_size;
+        --mpctx->sub_counts[SUB_SOURCE_SUBS];
         if (mpctx->set_of_sub_size > 0)
             subdata = set_of_subtitles[mpctx->set_of_sub_pos = 0];
     } else if (mpctx->set_of_sub_size > 0 && subdata != NULL) { // *subdata was changed
@@ -1142,6 +1143,7 @@ void update_set_of_subtitles(void)
     } else if (mpctx->set_of_sub_size <= 0 && subdata != NULL) { // *subdata was added
         set_of_subtitles[mpctx->set_of_sub_pos = mpctx->set_of_sub_size] = subdata;
         ++mpctx->set_of_sub_size;
+        ++mpctx->sub_counts[SUB_SOURCE_SUBS];
     }
 }