[vlc-commits] macosx/playlist: fix runtime exception
Felix Paul Kühne
git at videolan.org
Sat Feb 2 10:22:33 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Feb 2 10:21:24 2019 +0100| [5947c35106ac706a018189274247eecc58d10505] | committer: Felix Paul Kühne
macosx/playlist: fix runtime exception
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5947c35106ac706a018189274247eecc58d10505
---
modules/gui/macosx/VLCPlaylistController.m | 9 +++++----
modules/gui/macosx/VLCPlaylistModel.h | 2 +-
modules/gui/macosx/VLCPlaylistModel.m | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx/VLCPlaylistController.m b/modules/gui/macosx/VLCPlaylistController.m
index 6b816a6693..f43b95788d 100644
--- a/modules/gui/macosx/VLCPlaylistController.m
+++ b/modules/gui/macosx/VLCPlaylistController.m
@@ -39,7 +39,7 @@ NSString *VLCPlaybackHasNextChanged = @"VLCPlaybackHasNextChanged";
vlc_playlist_listener_id *_playlistListenerID;
}
-- (void)playlistResetWithItems:(NSArray *)items count:(size_t)numberOfItems;
+- (void)playlistResetWithItems:(NSArray *)items;
- (void)playlistAdded:(NSArray *)items atIndex:(size_t)insertionIndex count:(size_t)numberOfItems;
- (void)playlistRemovedItemsAtIndex:(size_t)index count:(size_t)numberOfItems;
- (void)playlistUpdatedForIndex:(size_t)firstUpdatedIndex items:(vlc_playlist_item_t *const *)items count:(size_t)numberOfItems;
@@ -60,6 +60,7 @@ cb_playlist_items_reset(vlc_playlist_t *playlist,
size_t numberOfItems,
void *p_data)
{
+ VLC_UNUSED(numberOfItems);
NSMutableArray *array = [NSMutableArray arrayWithCapacity:numberOfItems];
for (size_t i = 0; i < numberOfItems; i++) {
VLCPlaylistItem *item = [[VLCPlaylistItem alloc] initWithPlaylistItem:items[i]];
@@ -67,7 +68,7 @@ cb_playlist_items_reset(vlc_playlist_t *playlist,
}
dispatch_async(dispatch_get_main_queue(), ^{
VLCPlaylistController *playlistController = (__bridge VLCPlaylistController *)p_data;
- [playlistController playlistResetWithItems:array count:numberOfItems];
+ [playlistController playlistResetWithItems:array];
});
}
@@ -222,7 +223,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
#pragma mark - callback forwarders
-- (void)playlistResetWithItems:(NSArray *)items count:(size_t)numberOfItems
+- (void)playlistResetWithItems:(NSArray *)items
{
[_playlistModel addItems:items];
@@ -231,7 +232,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
- (void)playlistAdded:(NSArray *)items atIndex:(size_t)insertionIndex count:(size_t)numberOfItems
{
- [_playlistModel addItems:items atIndex:insertionIndex];
+ [_playlistModel addItems:items atIndex:insertionIndex count:numberOfItems];
[_playlistDataSource playlistUpdated];
}
diff --git a/modules/gui/macosx/VLCPlaylistModel.h b/modules/gui/macosx/VLCPlaylistModel.h
index c6ce2c22dd..f55d9f6a10 100644
--- a/modules/gui/macosx/VLCPlaylistModel.h
+++ b/modules/gui/macosx/VLCPlaylistModel.h
@@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)dropExistingData;
- (VLCPlaylistItem *)playlistItemAtIndex:(NSInteger)index;
- (void)addItems:(NSArray *)array;
-- (void)addItems:(NSArray *)array atIndex:(size_t)index;
+- (void)addItems:(NSArray *)array atIndex:(size_t)index count:(size_t)count;
- (void)removeItemsInRange:(NSRange)range;
- (void)updateItemAtIndex:(size_t)index;
diff --git a/modules/gui/macosx/VLCPlaylistModel.m b/modules/gui/macosx/VLCPlaylistModel.m
index 26dce6403d..45d7499e05 100644
--- a/modules/gui/macosx/VLCPlaylistModel.m
+++ b/modules/gui/macosx/VLCPlaylistModel.m
@@ -68,9 +68,9 @@
[_playlistArray addObjectsFromArray:array];
}
-- (void)addItems:(NSArray *)array atIndex:(size_t)index
+- (void)addItems:(NSArray *)array atIndex:(size_t)index count:(size_t)count
{
- [_playlistArray insertObjects:array atIndexes:[NSIndexSet indexSetWithIndex:index]];
+ [_playlistArray insertObjects:array atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(index, count)]];
}
- (void)removeItemsInRange:(NSRange)range
More information about the vlc-commits
mailing list