aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2015-08-28 18:55:44 +0200
committerMartijn Kaijser <martijn@xbmc.org>2015-08-28 18:55:44 +0200
commit59716cae10633010fe0619fcc7a508b663795b94 (patch)
tree9cc1b8d277801dc3c167cfe8c0f4c2a2e2172efa
parent0209090b8204c2b60b79c5fceec5232af59ec8e4 (diff)
parent896511cb1bd03a0927903f5f65f8c572129e8154 (diff)
Merge pull request #7911 from Memphiz/osx_fix_volume_resolve3bp15.2rc1-Isengard
[osx] - fix crash on osx 10.7 when trying to resolve hdd names
-rw-r--r--xbmc/osx/DarwinUtils.h1
-rw-r--r--xbmc/osx/DarwinUtils.mm14
-rw-r--r--xbmc/storage/osx/DarwinStorageProvider.cpp8
3 files changed, 23 insertions, 0 deletions
diff --git a/xbmc/osx/DarwinUtils.h b/xbmc/osx/DarwinUtils.h
index 77635489fe..0a0423edc1 100644
--- a/xbmc/osx/DarwinUtils.h
+++ b/xbmc/osx/DarwinUtils.h
@@ -33,6 +33,7 @@ public:
static const char *getIosPlatformString(void);
static bool IsAppleTV2(void);
static bool IsMavericks(void);
+ static bool IsLion(void);
static bool IsSnowLeopard(void);
static bool DeviceHasRetina(double &scale);
static const char *GetOSReleaseString(void);
diff --git a/xbmc/osx/DarwinUtils.mm b/xbmc/osx/DarwinUtils.mm
index 75ece9f8b5..b1b282f5d1 100644
--- a/xbmc/osx/DarwinUtils.mm
+++ b/xbmc/osx/DarwinUtils.mm
@@ -212,6 +212,20 @@ bool CDarwinUtils::IsMavericks(void)
return isMavericks == 1;
}
+bool CDarwinUtils::IsLion(void)
+{
+ static int isLion = -1;
+#if defined(TARGET_DARWIN_OSX)
+ if (isLion == -1)
+ {
+ double appKitVersion = floor(NSAppKitVersionNumber);
+ // everything lower 10.8 is 10.7.x because 10.7 is deployment target...
+ isLion = (appKitVersion < NSAppKitVersionNumber10_8) ? 1 : 0;
+ }
+#endif
+ return isLion == 1;
+}
+
bool CDarwinUtils::IsSnowLeopard(void)
{
static int isSnowLeopard = -1;
diff --git a/xbmc/storage/osx/DarwinStorageProvider.cpp b/xbmc/storage/osx/DarwinStorageProvider.cpp
index 6be9ab13cd..19c99b7ef2 100644
--- a/xbmc/storage/osx/DarwinStorageProvider.cpp
+++ b/xbmc/storage/osx/DarwinStorageProvider.cpp
@@ -29,6 +29,7 @@
#include <DiskArbitration/DiskArbitration.h>
#include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h>
+#include "osx/DarwinUtils.h"
#endif
#include "osx/CocoaInterface.h"
@@ -62,6 +63,9 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives)
share.strName = "Volumes";
share.m_ignore = true;
localDrives.push_back(share);
+
+ if (CDarwinUtils::IsLion())
+ return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x
// This will pick up all local non-removable disks including the Root Disk.
DASessionRef session = DASessionCreate(kCFAllocatorDefault);
@@ -106,6 +110,10 @@ void CDarwinStorageProvider::GetLocalDrives(VECSOURCES &localDrives)
void CDarwinStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives)
{
#if defined(TARGET_DARWIN_OSX)
+
+ if (CDarwinUtils::IsLion())
+ return; //temp workaround for crash in Cocoa_GetVolumeNameFromMountPoint on 10.7.x
+
DASessionRef session = DASessionCreate(kCFAllocatorDefault);
if (session)
{