If the user opens the OpenAFS preference pane and choose the Mounts
tab, the preference pane crashes.
To fix the problem, do not assume that we can cast a NSdictionary
object to NSMutableDictionary.
Reviewed-on: https://gerrit.openafs.org/12446
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit
9d4be0bd01696768602a313f627a802b358b5885)
Change-Id: I7ff8c6cbc599f3e80d6365d9a56587bf5c641f5b
Reviewed-on: https://gerrit.openafs.org/12447
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
//get link configuration
NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
- mutabilityOption:NSPropertyListMutableContainers
- format:nil
- errorDescription:nil];
+ NSDictionary *linkDict = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+ mutabilityOption:NSPropertyListMutableContainers
+ format:nil
+ errorDescription:nil];
+ linkConfiguration = [linkDict mutableCopy];
//get link enabled status
NSNumber *linkEnabledStatus = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
//link configuration
NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
- mutabilityOption:NSPropertyListMutableContainers
- format:nil
- errorDescription:nil];
+ NSDictionary *linkDict = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+ mutabilityOption:NSPropertyListMutableContainers
+ format:nil
+ errorDescription:nil];
+ linkConfiguration = [linkDict mutableCopy];
}
// -------------------------------------------------------------------------------