private Signal(GLib.Object obj, string signal_name, Delegate marshaler) { tref = obj.ToggleRef; name = signal_name; tref.Signals [name] = this; this.marshaler = marshaler; }
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; }
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); } }
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); }
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); }
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); }
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); }
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); }
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); }
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; }