mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2008-06-17 Mike Kestner <mkestner@novell.com>
* glib/GType.cs (LookupType): traversed referenced assemblies to find types in currently unloaded assemblies. Fixes #400595. svn path=/trunk/gtk-sharp/; revision=106027
This commit is contained in:
parent
dddf13e2fb
commit
179d4b214f
@ -1,3 +1,8 @@
|
||||
2008-06-17 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/GType.cs (LookupType): traversed referenced assemblies to
|
||||
find types in currently unloaded assemblies. Fixes #400595.
|
||||
|
||||
2008-06-16 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||
|
||||
* atk/Object.custom:
|
||||
|
@ -151,6 +151,23 @@ namespace GLib {
|
||||
// cctor already calls g_type_init.
|
||||
}
|
||||
|
||||
static Type FindTypeInReferences (string type_name, Assembly asm, Hashtable visited)
|
||||
{
|
||||
if (visited.Contains (asm))
|
||||
return null;
|
||||
|
||||
visited [asm] = asm;
|
||||
Type result = asm.GetType (type_name);
|
||||
if (result == null)
|
||||
foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) {
|
||||
Assembly ref_asm = Assembly.Load (ref_name);
|
||||
result = FindTypeInReferences (type_name, ref_asm, visited);
|
||||
if (result != null)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Type LookupType (IntPtr typeid)
|
||||
{
|
||||
if (types.Contains (typeid))
|
||||
@ -159,12 +176,22 @@ namespace GLib {
|
||||
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
|
||||
string type_name = GetQualifiedName (native_name);
|
||||
Type result = null;
|
||||
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) {
|
||||
Assembly[] assemblies = (Assembly[]) AppDomain.CurrentDomain.GetAssemblies ().Clone ();
|
||||
foreach (Assembly asm in assemblies) {
|
||||
result = asm.GetType (type_name);
|
||||
if (result != null)
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
Hashtable visited = new Hashtable ();
|
||||
foreach (Assembly asm in assemblies) {
|
||||
result = FindTypeInReferences (type_name, asm, visited);
|
||||
if (result != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Register (new GType (typeid), result);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user