lauromoura pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e130d808cdc84b9e74d4d929a75a04c5e2175ef3

commit e130d808cdc84b9e74d4d929a75a04c5e2175ef3
Author: Lauro Moura <[email protected]>
Date:   Fri Nov 15 00:09:29 2019 -0300

    csharp: FunctionPtr wrappers are not IDisposable
    
    Summary:
    They don't actually store unmanaged memory and we already rely on the GC
    to free them (not calling Dispose() directly through the managedCb
    closure, so we don't need IDisposable.
    
    Just making sure we release the Function Pointer data in the main loop
    as the GC runs in a different thread.
    
    Ref T8423
    
    Depends on D10672
    
    Reviewers: brunobelo, felipealmeida, YOhoho
    
    Reviewed By: brunobelo
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8423
    
    Differential Revision: https://phab.enlightenment.org/D10673
---
 .../eolian_mono/eolian/mono/function_pointer.hh    | 25 ++--------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/bin/eolian_mono/eolian/mono/function_pointer.hh 
b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
index aee11ea5a0..3b5040373f 100644
--- a/src/bin/eolian_mono/eolian/mono/function_pointer.hh
+++ b/src/bin/eolian_mono/eolian/mono/function_pointer.hh
@@ -72,7 +72,7 @@ struct function_pointer {
           return false;
 
       // Wrapper type, with callback matching the Unamanaged one
-      if (!as_generator("internal class " << f_name << "Wrapper : 
IDisposable\n"
+      if (!as_generator("internal class " << f_name << "Wrapper\n"
                   << "{\n\n"
                   << scope_tab << "private " << f_name  << "Internal _cb;\n"
                   << scope_tab << "private IntPtr _cb_data;\n"
@@ -87,33 +87,12 @@ struct function_pointer {
 
                   << scope_tab << "~" << f_name << "Wrapper()\n"
                   << scope_tab << "{\n"
-                  << scope_tab << scope_tab << "Dispose(false);\n"
-                  << scope_tab << "}\n\n"
-
-                  << scope_tab << "protected virtual void Dispose(bool 
disposing)\n"
-                  << scope_tab << "{\n"
                   << scope_tab << scope_tab << "if (this._cb_free_cb != 
null)\n"
                   << scope_tab << scope_tab << "{\n"
-                  << scope_tab << scope_tab << scope_tab << "if (disposing)\n"
-                  << scope_tab << scope_tab << scope_tab << "{\n"
-                  << scope_tab << scope_tab << scope_tab << scope_tab << 
"this._cb_free_cb(this._cb_data);\n"
-                  << scope_tab << scope_tab << scope_tab << "}\n"
-                  << scope_tab << scope_tab << scope_tab << "else\n"
-                  << scope_tab << scope_tab << scope_tab << "{\n"
-                  << scope_tab << scope_tab << scope_tab << scope_tab << 
"Efl.Eo.Globals.ThreadSafeFreeCbExec(this._cb_free_cb, this._cb_data);\n"
-                  << scope_tab << scope_tab << scope_tab << "}\n"
-                  << scope_tab << scope_tab << scope_tab << "this._cb_free_cb 
= null;\n"
-                  << scope_tab << scope_tab << scope_tab << "this._cb_data = 
IntPtr.Zero;\n"
-                  << scope_tab << scope_tab << scope_tab << "this._cb = 
null;\n"
+                  << scope_tab << scope_tab << scope_tab << 
"Efl.Eo.Globals.ThreadSafeFreeCbExec(this._cb_free_cb, this._cb_data);\n"
                   << scope_tab << scope_tab << "}\n"
                   << scope_tab << "}\n\n"
 
-                  << scope_tab << "public void Dispose()\n"
-                  << scope_tab << "{\n"
-                  << scope_tab << scope_tab << "Dispose(true);\n"
-                  << scope_tab << scope_tab << "GC.SuppressFinalize(this);\n"
-                  << scope_tab << "}\n\n"
-
                   << scope_tab << "internal " << type << " ManagedCb(" << 
(parameter % ", ") << ")\n"
                   << scope_tab << "{\n"
                   << function_definition_preamble << "_cb(_cb_data, " << 
(argument_invocation % ", ") << ");\n"

-- 


Reply via email to