mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2003-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* glib/Object.cs: (GetObject): check that the target of the WeakReference is still there. Otherwise, create a new wrapper for the IntPtr. This fixes the random nullrefs when running nunit-gtk. svn path=/trunk/gtk-sharp/; revision=13450
This commit is contained in:
parent
0d5cea38d4
commit
1840bd7ef1
@ -1,3 +1,11 @@
|
||||
2003-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||
|
||||
* glib/Object.cs:
|
||||
(GetObject): check that the target of the WeakReference is still there. Otherwise,
|
||||
create a new wrapper for the IntPtr.
|
||||
|
||||
This fixes the random nullrefs when running nunit-gtk.
|
||||
|
||||
2003-04-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||
|
||||
* generator/CallbackGen.cs: the new generated wrappers have:
|
||||
|
@ -163,8 +163,15 @@ namespace GLib {
|
||||
public static Object GetObject(IntPtr o)
|
||||
{
|
||||
WeakReference obj = Objects[o] as WeakReference;
|
||||
if (obj != null)
|
||||
return obj.Target as GLib.Object;
|
||||
if (obj != null) {
|
||||
// If the target object has not been collected, use it...
|
||||
if (obj.IsAlive)
|
||||
return obj.Target as GLib.Object;
|
||||
|
||||
// ... otherwise we create a new wrapper around the IntPtr.
|
||||
Objects [o] = null;
|
||||
}
|
||||
|
||||
return GtkSharp.ObjectManager.CreateObject(o);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user