forked from enlightenment/efl
efl_mono: support multilevel inheritance of NativeClass
Summary: When it creates multilevel class of NativeClass, internal c function is not called because eo vtables aren't created Test Plan: Check "MyBox2 UpdateLayout" printed. ``` //mcs test_box.cs -out:test_box.exe `pkg-config --libs efl-mono` //mono test_box.exe using System; public class MyBox2 : MyBox { public MyBox2(Efl.Object parent, string style = null) : base(parent, style) { } public override void UpdateLayout() { Eina.Log.Error("MyBox2 UpdateLayout"); base.UpdateLayout(); } } public class MyBox : Efl.Ui.Box { public MyBox(Efl.Object parent, string style = null) : base(parent, style) { } public override void UpdateLayout() { Eina.Log.Error("MyBox UpdateLayout"); base.UpdateLayout(); } } public class Example : Efl.Csharp.Application { protected override void OnInitialize(Eina.Array<System.String> args) { Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain); var box = new MyBox(win); box.SetHintSizeMin(new Eina.Size2D(360, 240)); win.SetContent(box); var box2 = new MyBox2(win); box2.SetHintSizeMin(new Eina.Size2D(360, 240)); box2.Pack(box); var button = new Efl.Ui.Button(box); button.SetText("Click"); button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) => { box.CalculateGroup(); box2.CalculateGroup(); }; box.Pack(button); } public static void Main() { var example = new Example(); example.Launch(); } } ``` Reviewers: segfaultxavi, vitor.sousa, felipealmeida, lauromoura, woohyun, Jaehyun_Cho Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9079
This commit is contained in:
parent
0a4beb291d
commit
e712261e14
|
@ -334,7 +334,16 @@ public class Globals
|
|||
public static byte class_initializer_call(IntPtr klass, System.Type type)
|
||||
{
|
||||
Eina.Log.Debug($"called with 0x{klass.ToInt64():x} {type}");
|
||||
Efl.Eo.NativeClass nativeClass = GetNativeClass(type.BaseType);
|
||||
var derived = type.BaseType;
|
||||
Efl.Eo.NativeClass nativeClass = GetNativeClass(derived);
|
||||
|
||||
while (nativeClass == null)
|
||||
{
|
||||
derived = derived.BaseType;
|
||||
if (derived == null)
|
||||
break;
|
||||
nativeClass = GetNativeClass(derived);
|
||||
}
|
||||
|
||||
if (nativeClass != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue