-
Notifications
You must be signed in to change notification settings - Fork 554
[CoreFoundation] Add Clone method for CFArray. #7403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
| using CFArrayRef = System.IntPtr; | ||
| using CFAllocatorRef = System.IntPtr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we name IntPtrs with using statements and not just use IntPtrdirectly for the parmeter types in Clone()? There's other bindings that use IntPtr directly and mention the objc/c type in an inline comment. What's the standard practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is easier to read. I would have changed all, but would have increase the diff. It does not change the output result of the binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Build failure Test results1 tests failed, 86 tests passed.Failed tests
|
spouliot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's a manual binding it should have a test
e.g. just check that the cloned array has a different handle but the same items (and item's handle)
|
@spouliot CFArray is not public. Do you want me to change the internals visibility to be able to write the test? |
|
@mandel-macaque forgot about that, it will be tested w/CFBundle anyway :) |
When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
|
@monojenkins backport xcode11.3 |
When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
* [CoreFoundation] CFBundle.GetAll better thread safe. The initial solution fixed the rance condition in which the index changed, but that did not guarantee that we would get the correct bundles. We now clone the CFArray (which also clones the callbacks set to the array) and iterate over it to make sure Apple does not do evil tings while we are iteraing. Better Fixes: https://github.com/xamarin/maccore/issues/940 * [CoreFoundation] Add Clone method for CFArray. (#7403) When working on https://github.com/xamarin/maccore/issues/940 we noticed that clone the array would be a better approach. The CFArrayCreateCopy add some nice things: * The pointer values from theArray are copied into the new array. * The values are also retained by the new array. * The count of the new array is the same as theArray * The new array uses the same callbacks as theArray. [IMPORTANT] Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940

When working on https://github.com/xamarin/maccore/issues/940 we noticed
that clone the array would be a better approach.
The CFArrayCreateCopy add some nice things:
With this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940