Esempio n. 1
0
        private static void RmRef(ref IntPtr ptr)
        {
            lock (reflock)
            {
                if (_refs.ContainsKey(ptr))
                {
                    if (ptr == IntPtr.Zero)
                    {
                        throw new Exception("OHHH NOOOO!!!");
                    }
#if REFDEBUG
                    Console.WriteLine("Removing a reference to: " + ptr + " (" + _refs[ptr] + "==> " + (_refs[ptr] - 1) + ")");
#endif
                    _refs[ptr]--;
                    if (_refs[ptr] == 0)
                    {
#if REFDEBUG
                        Console.WriteLine("KILLING " + ptr + " BECAUSE IT'S DEAD!");
#endif
                        _refs.Remove(ptr);
                        XmlRpcUtil.Free(ptr);
                    }
                    return;
                }
                ptr = IntPtr.Zero;
                throw new Exception("OHHH NOOOO!!!");
            }
        }
Esempio n. 2
0
        private static void RmRef(ref IntPtr ptr)
        {
            lock (reflock)
            {
                if (_refs.ContainsKey(ptr))
                {
#if REFDEBUGWrapper
                    Console.WriteLine("Removing a reference to: " + ptr + " (" + _refs[ptr] + "==> " + (_refs[ptr] - 1) + ")");
#endif
                    _refs[ptr]--;
                    if (_refs[ptr] <= 0)
                    {
#if REFDEBUGWrapper
                        Console.WriteLine("KILLING " + ptr + " BECAUSE IT'S NOT VERY NICE!");
#endif
                        _refs.Remove(ptr);
                        XmlRpcUtil.Free(ptr);
                        ptr = IntPtr.Zero;
                    }
                }
            }
        }