dbus/mono ProxyBuilder.cs,1.9,1.10

Joe Shaw joe at freedesktop.org
Tue Mar 15 15:30:57 PST 2005


Update of /cvs/dbus/dbus/mono
In directory gabe:/tmp/cvs-serv9991/mono

Modified Files:
	ProxyBuilder.cs 
Log Message:
2005-03-15  Joe Shaw  <joeshaw at novell.com>

	* mono/ProxyBuilder.cs (BuildFinalizer): Fix some invalid IL when
	generating the finalizer.  Fixes from Ben Maurer.

Index: ProxyBuilder.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/ProxyBuilder.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ProxyBuilder.cs	13 Mar 2005 05:07:35 -0000	1.9
+++ ProxyBuilder.cs	15 Mar 2005 23:30:55 -0000	1.10
@@ -468,7 +468,7 @@
       generator.Emit(OpCodes.Ret);
     }
     
-    public void BuildFinalizer (TypeBuilder tb, FieldInfo fi)
+    public void BuildFinalizer (TypeBuilder tb, FieldInfo serviceF, FieldInfo deleF)
     {
        // Note that this is a *HORRIBLE* example of how to build a finalizer
        // It doesn't use the try/finally to chain to Object::Finalize. However,
@@ -485,8 +485,10 @@
 
        //generator.EmitWriteLine("this.service.SignalCalled -= this.delegate_created");
        generator.Emit (OpCodes.Ldarg_0);
-       generator.Emit (OpCodes.Ldfld, fi);
-       generator.Emit (OpCodes.Call, Service_RemoveSignalCalledMI);
+       generator.Emit (OpCodes.Ldfld, serviceF);
+       generator.Emit (OpCodes.Ldarg_0);
+       generator.Emit (OpCodes.Ldfld, deleF);
+       generator.EmitCall (OpCodes.Callvirt, Service_RemoveSignalCalledMI, null);
        generator.Emit (OpCodes.Ret);
     }
     
@@ -556,7 +558,7 @@
 	FieldBuilder deleF = typeB.DefineField("delegate_created", 
 					       typeof(Service.SignalCalledHandler), 
 					       FieldAttributes.Private);
-	BuildFinalizer (typeB, deleF);
+	BuildFinalizer (typeB, serviceF, deleF);
 	
 	MethodInfo signalCalledMI = BuildSignalCalled(ref typeB, serviceF, pathF);
 	BuildConstructor(ref typeB, serviceF, pathF, signalCalledMI, deleF);



More information about the dbus-commit mailing list