Copy() protected method

protected Copy ( IntPtr raw ) : Opaque
raw IntPtr
return Opaque
Esempio n. 1
0
        public static Opaque GetOpaque(IntPtr o, Type type, bool owned)
        {
            if (o == IntPtr.Zero)
            {
                return(null);
            }

            Opaque opaque = (Opaque)Activator.CreateInstance(type, new object[] { o });

            if (owned)
            {
                if (opaque.owned)
                {
                    // The constructor took a Ref it shouldn't have, so undo it
                    opaque.Unref(o);
                }
                opaque.owned = true;
            }
            else
            {
                opaque = opaque.Copy(o);
            }

            return(opaque);
        }
Esempio n. 2
0
        public static Opaque GetOpaque(IntPtr o, Type type, bool owned)
        {
            Opaque opaque = FastActivator.CreateOpaque(o, type);

            if (owned)
            {
                if (opaque.Owned)
                {
                    // The constructor took a Ref it shouldn't have, so undo it
                    opaque.Unref(o);
                }
                opaque.Owned = true;
            }
            else
            {
                opaque = opaque.Copy(o);
            }

            return(opaque);
        }