Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake info_dictionary return mutable dictionary #146
Conversation
|
Another way to solve it would be to continue let CFDictionary::to_mutable(&self) -> CFMutableDictionaryThat could be used to convert any dictionary to a mutable if you know what you are doing. But I guess someone with better understanding of core foundation would have to fill in here. |
|
In this case I think we can just drop this code from servo/glutin. It looks like it was added before servo/servo#11899 and was a hack to set the app name without having a .app It's not unlikely that we'll run into this kind of thing elsewhere and I feel like CFDictionary::to_mutable(&self) will probably be the best solution but we can probably wait until we encounter it again. |
|
I agree with @jrmuizel's conclusions. |
faern commentedJan 21, 2018
•
edited
The problem is that glutin sets a value in an immutable dict here: https://github.com/servo/glutin/blob/servo/src/api/cocoa/mod.rs#L403. That does not work any longer after #135, since
set_valueis gone.CFBundleGetInfoDictionaryreturns aCFDictionaryRef(not aCFMutableDictionaryRef) and the docs on that function does not mention the returned dictionary being mutable. So if going by that information, this PR changes into something wrong. But if the code in glutin is correct (which I know nothing about, only have to assume), then it can obviously set a value in the dict. So is it mutable?One way to solve it is in the way done in this PR at the moment. Because then glutin can continue to set the value in the dict. But if we think the returned dict should be immutable in general (as the Apple docs seems to indicate?), then we could keep this crate as is, but instead make glutin step down one level and call
CFDictionarySetValueunsafely by itself.This change is