mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-02-02 17:20:59 +00:00
Fix resurrection cycles in container subclasses (bxc#3801)
This commit is contained in:
parent
d686a4d6aa
commit
b5e0d297bb
|
@ -134,9 +134,16 @@ namespace Gtk {
|
||||||
static void ForallOld_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
|
static void ForallOld_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Container obj = GLib.Object.GetObject (container, false) as Container;
|
//GtkContainer's unmanaged dispose calls forall, but by that time the managed object is gone
|
||||||
CallbackInvoker invoker = new CallbackInvoker (cb, data);
|
//so it couldn't do anything useful, and resurrecting it would cause a resurrection cycle.
|
||||||
obj.ForAll (include_internals, invoker);
|
//In that case, just chain to the native base in case it can do something.
|
||||||
|
Container obj = (Container) GLib.Object.TryGetObject (container);
|
||||||
|
if (obj != null) {
|
||||||
|
CallbackInvoker invoker = new CallbackInvoker (cb, data);
|
||||||
|
obj.ForAll (include_internals, invoker);
|
||||||
|
} else {
|
||||||
|
gtksharp_container_base_forall (container, include_internals, cb, data);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
||||||
}
|
}
|
||||||
|
@ -159,9 +166,16 @@ namespace Gtk {
|
||||||
static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
|
static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Container obj = GLib.Object.GetObject (container, false) as Container;
|
//GtkContainer's unmanaged dispose calls forall, but by that time the managed object is gone
|
||||||
CallbackInvoker invoker = new CallbackInvoker (cb, data);
|
//so it couldn't do anything useful, and resurrecting it would cause a resurrection cycle.
|
||||||
obj.ForAll (include_internals, new Gtk.Callback (invoker.Invoke));
|
//In that case, just chain to the native base in case it can do something.
|
||||||
|
Container obj = (Container) GLib.Object.TryGetObject (container);
|
||||||
|
if (obj != null) {
|
||||||
|
CallbackInvoker invoker = new CallbackInvoker (cb, data);
|
||||||
|
obj.ForAll (include_internals, new Gtk.Callback (invoker.Invoke));
|
||||||
|
} else {
|
||||||
|
gtksharp_container_base_forall (container, include_internals, cb, data);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
GLib.ExceptionManager.RaiseUnhandledException (e, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue