lauromoura pushed a commit to branch master.

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

commit 0839dbc6113fcf9a02cec129facea0fc50823e93
Author: Felipe Magno de Almeida <[email protected]>
Date:   Tue Oct 1 00:06:13 2019 -0300

    csharp: Load library in permanent way for static members and not rely on 
leaks
    
    Summary:
    The LoadFunctionPointer relied on leaks of NativeModules by not
    disposing them. Instead do direct loading without instantiating
    unnecessary objects.
    
    Reviewers: lauromoura, woohyun, brunobelo
    
    Reviewed By: lauromoura
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D10258
---
 src/bindings/mono/eo_mono/FunctionWrapper.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/bindings/mono/eo_mono/FunctionWrapper.cs 
b/src/bindings/mono/eo_mono/FunctionWrapper.cs
index 04a5f05614..11560bd8b8 100644
--- a/src/bindings/mono/eo_mono/FunctionWrapper.cs
+++ b/src/bindings/mono/eo_mono/FunctionWrapper.cs
@@ -20,10 +20,10 @@ public partial class FunctionInterop
     ///<returns>A function pointer that can be used with delegates.</returns>
     public static IntPtr LoadFunctionPointer(string moduleName, string 
functionName)
     {
-        NativeModule module = new NativeModule(moduleName);
-        Eina.Log.Debug($"searching {module.Module} for {functionName}");
-        var s = FunctionInterop.dlsym(module.Module, functionName);
-        Eina.Log.Debug($"searching {module.Module} for{functionName}, result 
{s}");
+        IntPtr module = NativeModule.LoadLibrary(moduleName);
+        Eina.Log.Debug($"searching {module} for {functionName}");
+        var s = FunctionInterop.dlsym(module, functionName);
+        Eina.Log.Debug($"searching {module} for{functionName}, result {s}");
         return s;
     }
 

-- 


Reply via email to