From 42618957c74ad1d842f1ec693b07a30516b123bc Mon Sep 17 00:00:00 2001 From: Julien Wadel <julien.wadel@belledonne-communications.com> Date: Wed, 29 Jul 2020 18:45:09 +0200 Subject: [PATCH] Use liblinphone for LIB_NAME on Windows only Reorder freeing memory when Marshalling on Native Windows ID Add import grammar for CS --- config.h.cmake | 1 - wrappers/csharp/wrapper_impl.mustache | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config.h.cmake b/config.h.cmake index 42b12731ec..ab8b6b0b07 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -50,6 +50,5 @@ #cmakedefine HAVE_ADVANCED_IM #cmakedefine HAVE_DB_STORAGE #cmakedefine ENABLE_UPDATE_CHECK 1 -#cmakedefine ENABLE_MICROSOFT_STORE_APP #cmakedefine HAVE_GETIFADDRS diff --git a/wrappers/csharp/wrapper_impl.mustache b/wrappers/csharp/wrapper_impl.mustache index c2eec01710..238c2381bb 100644 --- a/wrappers/csharp/wrapper_impl.mustache +++ b/wrappers/csharp/wrapper_impl.mustache @@ -35,6 +35,8 @@ namespace Linphone public const string VERSION = "{{version}}"; #if __IOS__ public const string LIB_NAME = "linphone.framework/linphone"; +#elif WINDOWS_UWP + public const string LIB_NAME = "liblinphone"; // With this, it automatically finds liblinphone.dll #else public const string LIB_NAME = "linphone"; // With this, it automatically finds liblinphone.so #endif @@ -448,9 +450,11 @@ namespace Linphone } set { + IntPtr string_ptr_to_remove = linphone_call_get_native_video_window_id(nativePtr); IntPtr string_ptr = Marshal.StringToHGlobalUni(value); linphone_call_set_native_video_window_id(nativePtr, string_ptr); - Marshal.FreeHGlobal(string_ptr); + if(string_ptr_to_remove != IntPtr.Zero) + Marshal.FreeHGlobal(string_ptr_to_remove); } } {{/isLinphoneCall}} @@ -477,9 +481,11 @@ namespace Linphone } set { + IntPtr string_ptr_to_remove = linphone_core_get_native_video_window_id(nativePtr); + if(string_ptr_to_remove != IntPtr.Zero) + Marshal.FreeHGlobal(string_ptr_to_remove); IntPtr string_ptr = Marshal.StringToHGlobalUni(value); linphone_core_set_native_video_window_id(nativePtr, string_ptr); - Marshal.FreeHGlobal(string_ptr); } } @@ -492,9 +498,11 @@ namespace Linphone } set { + IntPtr string_ptr_to_remove = linphone_core_get_native_preview_window_id(nativePtr); + if(string_ptr_to_remove != IntPtr.Zero) + Marshal.FreeHGlobal(string_ptr_to_remove); IntPtr string_ptr = Marshal.StringToHGlobalUni(value); linphone_core_set_native_preview_window_id(nativePtr, string_ptr); - Marshal.FreeHGlobal(string_ptr); } } {{/isLinphoneCore}} -- GitLab