From 0839dbc6113fcf9a02cec129facea0fc50823e93 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Tue, 1 Oct 2019 00:06:13 -0300 Subject: [PATCH] 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 ///A function pointer that can be used with delegates. 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; }