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
2 changed files with 33 additions and 1 deletions
|
@ -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>
|
2008-06-16 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||||
|
|
||||||
* atk/Object.custom:
|
* atk/Object.custom:
|
||||||
|
|
|
@ -151,6 +151,23 @@ namespace GLib {
|
||||||
// cctor already calls g_type_init.
|
// 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)
|
public static Type LookupType (IntPtr typeid)
|
||||||
{
|
{
|
||||||
if (types.Contains (typeid))
|
if (types.Contains (typeid))
|
||||||
|
@ -159,12 +176,22 @@ namespace GLib {
|
||||||
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
|
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
|
||||||
string type_name = GetQualifiedName (native_name);
|
string type_name = GetQualifiedName (native_name);
|
||||||
Type result = null;
|
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);
|
result = asm.GetType (type_name);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
break;
|
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);
|
Register (new GType (typeid), result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue