From eab4eadebd8c01754df363851e182547869f2fca Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 24 Feb 2017 13:50:54 +0100 Subject: [PATCH] Fix resources paths issues. --- coreapi/factory.c | 12 ++++++------ coreapi/linphonecore.c | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/coreapi/factory.c b/coreapi/factory.c index a5242af2d..867d6be24 100644 --- a/coreapi/factory.c +++ b/coreapi/factory.c @@ -108,7 +108,7 @@ LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) { } char * linphone_factory_get_top_resources_dir(const LinphoneFactory *factory) { - if (factory->top_resources_dir) return factory->top_resources_dir; + if (factory->top_resources_dir) return bctbx_strdup(factory->top_resources_dir); return bctbx_strdup(PACKAGE_DATA_DIR); } @@ -118,7 +118,7 @@ void linphone_factory_set_top_resources_dir(LinphoneFactory *factory, const char } char * linphone_factory_get_data_resources_dir(const LinphoneFactory *factory) { - if (factory->data_resources_dir) return factory->data_resources_dir; + if (factory->data_resources_dir) return bctbx_strdup(factory->data_resources_dir); if (factory->top_resources_dir) return bctbx_strdup_printf("%s/linphone", factory->top_resources_dir); return bctbx_strdup_printf("%s/linphone", PACKAGE_DATA_DIR); } @@ -129,7 +129,7 @@ void linphone_factory_set_data_resources_dir(LinphoneFactory *factory, const cha } char * linphone_factory_get_sound_resources_dir(const LinphoneFactory *factory) { - if (factory->sound_resources_dir) return factory->sound_resources_dir; + if (factory->sound_resources_dir) return bctbx_strdup(factory->sound_resources_dir); if (factory->top_resources_dir) return bctbx_strdup_printf("%s/sounds/linphone", factory->top_resources_dir); return bctbx_strdup(PACKAGE_SOUND_DIR); } @@ -140,7 +140,7 @@ void linphone_factory_set_sound_resources_dir(LinphoneFactory *factory, const ch } char * linphone_factory_get_ring_resources_dir(const LinphoneFactory *factory) { - if (factory->ring_resources_dir) return factory->ring_resources_dir; + if (factory->ring_resources_dir) return bctbx_strdup(factory->ring_resources_dir); if (factory->sound_resources_dir) return bctbx_strdup_printf("%s/rings", factory->sound_resources_dir); return bctbx_strdup(PACKAGE_RING_DIR); } @@ -151,7 +151,7 @@ void linphone_factory_set_ring_resources_dir(LinphoneFactory *factory, const cha } char * linphone_factory_get_image_resources_dir(const LinphoneFactory *factory) { - if (factory->image_resources_dir) return factory->image_resources_dir; + if (factory->image_resources_dir) return bctbx_strdup(factory->image_resources_dir); if (factory->top_resources_dir) return bctbx_strdup_printf("%s/images", factory->top_resources_dir); return bctbx_strdup_printf("%s/images", PACKAGE_DATA_DIR); } @@ -162,7 +162,7 @@ void linphone_factory_set_image_resources_dir(LinphoneFactory *factory, const ch } char * linphone_factory_get_msplugins_dir(const LinphoneFactory *factory) { - return factory->msplugins_dir; + return bctbx_strdup(factory->msplugins_dir); } void linphone_factory_set_msplugins_dir(LinphoneFactory *factory, const char *path) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index cf1b39770..cbbe2c808 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1995,10 +1995,9 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig linphone_core_activate_log_serialization_if_needed(); msplugins_dir = linphone_factory_get_msplugins_dir(lfactory); - lc->factory = ms_factory_new_with_voip_and_plugins_dir(msplugins_dir); - if (msplugins_dir) bctbx_free(msplugins_dir); image_resources_dir = linphone_factory_get_image_resources_dir(lfactory); - ms_factory_set_image_resources_dir(lc->factory, image_resources_dir); + lc->factory = ms_factory_new_with_voip_and_directories(msplugins_dir, image_resources_dir); + if (msplugins_dir) bctbx_free(msplugins_dir); bctbx_free(image_resources_dir); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc);