From 2a369a341d5a9770adc8a48a0eec43f0ffca6090 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 31 Oct 2016 01:05:41 +0200 Subject: [PATCH] Simplified the code for generating virtual C# calls. Fixes https://github.com/mono/CppSharp/issues/706. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpSources.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 7a4cf7fb..6d64466d 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -2524,7 +2524,7 @@ namespace CppSharp.Generators.CSharp int vtableIndex = 0; if (Context.ParserOptions.IsMicrosoftAbi) vtableIndex = @class.Layout.VFTables.IndexOf(@class.Layout.VFTables.Where( - v => v.Layout.Components.Any(c => c.Method.OriginalPtr == method.OriginalPtr)).First()); + v => v.Layout.Components.Any(c => c.Method == @virtual)).First()); WriteLine("var {0} = *(void**) ((IntPtr) __OriginalVTables[{1}] + {2} * {3});", Helpers.SlotIdentifier, vtableIndex, i, Context.TargetInfo.PointerWidth / 8); if (method.IsDestructor && @class.IsAbstract)