[vlc-commits] macosx: Fix index out of bound crash in open dialog
David Fuhrmann
git at videolan.org
Thu Mar 5 19:15:51 CET 2015
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Mar 5 19:13:58 2015 +0100| [60a30462b2524fece671d2463917dd55379b824e] | committer: David Fuhrmann
macosx: Fix index out of bound crash in open dialog
This happend when multiple audio devices with the same name are
connected.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60a30462b2524fece671d2463917dd55379b824e
---
modules/gui/macosx/open.m | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 24c1470..d37d497 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -236,9 +236,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
for (int ivideo = 0; ivideo < deviceCount; ivideo++) {
QTCaptureDevice *qtk_device;
qtk_device = [qtkvideoDevices objectAtIndex:ivideo];
- [o_qtk_video_device_pop addItemWithTitle: [qtk_device localizedDisplayName]];
+ // allow same name for multiple times
+ [[o_qtk_video_device_pop menu] addItemWithTitle:[qtk_device localizedDisplayName] action:nil keyEquivalent:@""];
- if ([[[qtk_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid])
+ if ([[[qtk_device uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_currdevice_uid])
[o_qtk_video_device_pop selectItemAtIndex:ivideo];
}
} else {
@@ -258,11 +259,13 @@ static VLCOpen *_o_sharedMainInstance = nil;
NSUInteger deviceCount = [qtkaudioDevices count];
for (int iaudio = 0; iaudio < deviceCount; iaudio++) {
- QTCaptureDevice *qtkaudio_device;
- qtkaudio_device = [qtkaudioDevices objectAtIndex:iaudio];
- [o_qtk_audio_device_pop addItemWithTitle: [qtkaudio_device localizedDisplayName]];
- [o_screen_qtk_audio_pop addItemWithTitle: [qtkaudio_device localizedDisplayName]];
- if ([[[qtkaudio_device uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtkaudio_currdevice_uid]) {
+ QTCaptureDevice *qtkaudio_device = [qtkaudioDevices objectAtIndex:iaudio];
+
+ // allow same name for multiple times
+ [[o_qtk_audio_device_pop menu] addItemWithTitle:[qtkaudio_device localizedDisplayName] action:nil keyEquivalent:@""];
+ [[o_screen_qtk_audio_pop menu] addItemWithTitle:[qtkaudio_device localizedDisplayName] action:nil keyEquivalent:@""];
+
+ if ([[[qtkaudio_device uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtkaudio_currdevice_uid]) {
[o_qtk_audio_device_pop selectItemAtIndex:iaudio];
[o_screen_qtk_audio_pop selectItemAtIndex:iaudio];
}
More information about the vlc-commits
mailing list