Esempio n. 1
0
 private Signal(GLib.Object obj, string signal_name, Delegate marshaler)
 {
     tref = obj.ToggleRef;
     name = signal_name;
     tref.Signals [name] = this;
     this.marshaler      = marshaler;
 }
Esempio n. 2
0
 private Signal(GLib.Object obj, string signal_name, Type args_type)
 {
     tref                = obj.ToggleRef;
     name                = signal_name;
     this.args_type      = args_type;
     tref.Signals [name] = this;
 }
Esempio n. 3
0
 private Signal(GLib.Object obj, string signal_name, Type args_type)
 {
     tref = obj.ToggleRef;
     name = signal_name;
     this.args_type = args_type;
     tref.Signals [name] = this;
 }
Esempio n. 4
0
 private Signal(GLib.Object obj, string signal_name, Delegate marshaler)
 {
     tref = obj.ToggleRef;
     name = signal_name;
     tref.Signals [name] = this;
     this.marshaler = marshaler;
 }
Esempio n. 5
0
 static void RefToggled(IntPtr data, IntPtr handle, bool is_last_ref)
 {
     try {
         GCHandle  gch  = (GCHandle)data;
         ToggleRef tref = (ToggleRef)gch.Target;
         tref?.Toggle(is_last_ref);
     } catch (Exception e) {
         ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
Esempio n. 6
0
        public static Object TryGetObject(IntPtr o)
        {
            if (o == IntPtr.Zero)
            {
                return(null);
            }

            ToggleRef tr = (ToggleRef)Objects[o];

            if (tr != null && tr.IsAlive)
            {
                return(tr.Target);
            }

            return(null);
        }
Esempio n. 7
0
        static bool PerformQueuedUnrefs()
        {
            ToggleRef[] references;

            lock (PendingDestroys){
                references = new ToggleRef [PendingDestroys.Count];
                PendingDestroys.CopyTo(references, 0);
                PendingDestroys.Clear();
                idle_queued = false;
            }

            foreach (ToggleRef r in references)
            {
                r.Free();
            }

            return(false);
        }
Esempio n. 8
0
        public static Object GetObject(IntPtr o, bool owned_ref)
        {
            if (o == IntPtr.Zero)
            {
                return(null);
            }

            Object obj = null;

            if (Objects.Contains(o))
            {
                ToggleRef toggle_ref = Objects [o] as ToggleRef;
                if (toggle_ref != null && toggle_ref.IsAlive)
                {
                    obj = toggle_ref.Target;
                }
            }

            if (obj != null && obj.Handle == o)
            {
                if (owned_ref)
                {
                    g_object_unref(obj.Handle);
                }
                return(obj);
            }

            if (!owned_ref)
            {
                g_object_ref(o);
            }

            obj = GLib.ObjectManager.CreateObject(o);
            if (obj == null)
            {
                g_object_unref(o);
                return(null);
            }

            return(obj);
        }
Esempio n. 9
0
        public virtual void Dispose()
        {
            if (Handle == IntPtr.Zero)
            {
                return;
            }

            lock (Objects) {
                Objects.Remove(Handle);
                try {
                    if (tref != null)
                    {
                        tref.Free();
                        tref = null;
                    }
                } catch (Exception e) {
                    Console.WriteLine("Exception while disposing a " + this + " in Gtk#");
                    throw e;
                }
            }
            handle = IntPtr.Zero;
            GC.SuppressFinalize(this);
        }
Esempio n. 10
0
        public virtual void Dispose()
        {
            if (disposed)
            {
                return;
            }

            disposed = true;
            ToggleRef toggle_ref = Objects [Handle] as ToggleRef;

            Objects.Remove(Handle);
            try {
                if (toggle_ref != null)
                {
                    toggle_ref.Free();
                }
            } catch (Exception e) {
                Console.WriteLine("Exception while disposing a " + this + " in Gtk#");
                throw e;
            }
            handle = IntPtr.Zero;
            GC.SuppressFinalize(this);
        }
Esempio n. 11
0
        public static Object GetObject(IntPtr o, bool owned_ref)
        {
            if (o == IntPtr.Zero)
            {
                return(null);
            }

            Object    obj        = null;
            ToggleRef toggle_ref = null;

            lock (Objects)
                Objects.TryGetValue(o, out toggle_ref);

            if (toggle_ref != null)
            {
                obj = toggle_ref.Target;
            }

            if (obj != null && obj.Handle == o)
            {
                return(obj);
            }

            obj = GLib.ObjectManager.CreateObject(o);
            if (obj == null)
            {
                g_object_unref(o);
                return(null);
            }

            if (owned_ref)
            {
                g_object_unref(o);
            }
            return(obj);
        }
Esempio n. 12
0
        static bool PerformQueuedUnrefs()
        {
            ToggleRef[] references;

            lock (PendingDestroys){
                references = new ToggleRef [PendingDestroys.Count];
                PendingDestroys.CopyTo (references, 0);
                PendingDestroys.Clear ();
                idle_queued = false;
            }

            foreach (ToggleRef r in references)
                r.Free ();

            return false;
        }