[vlc-commits] macosx: Fix index out of bound crash in open dialog
David Fuhrmann
git at videolan.org
Thu Mar 5 19:18:21 CET 2015
vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Mar 5 19:13:58 2015 +0100| [78054320f888f02752fbb72ca67f983e998feca5] | 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.
(cherry picked from commit 60a30462b2524fece671d2463917dd55379b824e)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=78054320f888f02752fbb72ca67f983e998feca5
---
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 7cbe463..46a5190 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