summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eo_mono/iwrapper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/eo_mono/iwrapper.cs')
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 32f51e2936..e19e594725 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -774,10 +774,26 @@ public static class Globals
}
}
- internal static IntPtr IEnumerableToAccessor<T>(IEnumerable<T> enumerable)
+ internal static IntPtr IEnumerableToAccessor<T>(IEnumerable<T> enumerable, bool isMoved)
{
if (enumerable == null)
+ {
throw new ArgumentException("enumerable is null", nameof(enumerable));
+ }
+
+ // If we are a wrapper around an existing Eina.Accessor, we can just forward
+ // it and avoid unnecessary copying.
+ var wrappedAccessor = enumerable as Eina.Accessor<T>;
+
+ if (wrappedAccessor != null)
+ {
+ if (isMoved)
+ {
+ wrappedAccessor.Own = false;
+ }
+ return wrappedAccessor.Handle;
+ }
+
IntPtr[] intPtrs = new IntPtr[enumerable.Count()];
int i = 0;