forked from enlightenment/efl
efl-csharp: Make sure efl_finalize overrides are callable
Summary: efl_finalize override is called inside efl_add_end. Previously by this time the constructor still hadn't saved the C# wrapper handle into the Eo instance private data, to be recovered in the static delegates that call the C# overrides. This commit just changes the order to save the C# handle *before* calling efl_add_end. Test Plan: added unit test to be run with make check Reviewers: felipealmeida, vitor.sousa, Jaehyun_Cho Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6956
This commit is contained in:
parent
1e52108644
commit
5e107aa19d
|
@ -316,8 +316,8 @@ struct klass
|
|||
<< scope_tab << scope_tab << "if (init_cb != null) {\n"
|
||||
<< scope_tab << scope_tab << scope_tab << "init_cb(this);\n"
|
||||
<< scope_tab << scope_tab << "}\n"
|
||||
<< scope_tab << scope_tab << "handle = efl.eo.Globals.instantiate_end(handle);\n"
|
||||
<< scope_tab << scope_tab << "efl.eo.Globals.data_set(this);\n"
|
||||
<< scope_tab << scope_tab << "handle = efl.eo.Globals.instantiate_end(handle);\n"
|
||||
<< scope_tab << scope_tab << "eina.Error.RaiseIfOccurred();\n"
|
||||
<< scope_tab << "}\n"
|
||||
<< scope_tab << "///<summary>Destructor.</summary>\n"
|
||||
|
|
|
@ -246,4 +246,24 @@ class TestEoAccessors
|
|||
}
|
||||
}
|
||||
|
||||
class TestEoFinalize
|
||||
{
|
||||
public sealed class Inherit : efl.ObjectInherit
|
||||
{
|
||||
public bool finalizeCalled = false;
|
||||
public override efl.IObject FinalizeAdd()
|
||||
{
|
||||
finalizeCalled = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void finalize_call()
|
||||
{
|
||||
Inherit inherit = new Inherit();
|
||||
Test.Assert(inherit.finalizeCalled);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue