From: ritsuka <damiog@gmail.com> Date: Sat, 19 Jul 2014 08:22:28 +0000 (+0000) Subject: MacGui: Used a different api in HBDVDDetector to avoid DiskArbitration crashes. X-Git-Tag: 0.10.0~293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8eba50b3ff98e419cad4cc1753877292c82b21dd;p=handbrake MacGui: Used a different api in HBDVDDetector to avoid DiskArbitration crashes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6238 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/macosx/HBDVDDetector.m b/macosx/HBDVDDetector.m index 97b4802a1..6d12ed64e 100644 --- a/macosx/HBDVDDetector.m +++ b/macosx/HBDVDDetector.m @@ -10,7 +10,7 @@ #include <IOKit/IOKitLib.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IODVDMedia.h> -#include <DiskArbitration/DiskArbitration.h> +#include <sys/mount.h> #import "HBDVDDetector.h" @@ -80,29 +80,17 @@ return bsdName; } - NSURL *volumeURL = [NSURL fileURLWithPath:path]; + struct statfs s; + statfs([path fileSystemRepresentation], &s); - // Create a DADiskRef - DASessionRef session = DASessionCreate(kCFAllocatorDefault); - DADiskRef disk = DADiskCreateFromVolumePath(kCFAllocatorDefault, - session, - (CFURLRef)volumeURL); + bsdName = [NSString stringWithUTF8String:s.f_mntfromname]; - if ( disk ) + if ([bsdName hasPrefix:@"/dev/"]) { - CFDictionaryRef desc = DADiskCopyDescription(disk); - if ( desc ) - { - // Get the bsd name from it - bsdName = [(NSString *)CFDictionaryGetValue(desc, kDADiskDescriptionMediaBSDNameKey) retain]; - CFRelease(desc); - } - CFRelease(disk); + bsdName = [bsdName stringByReplacingCharactersInRange:NSMakeRange(0, 5) withString:@""]; } - CFRelease(session); - - return bsdName; + return [bsdName retain]; }