Commit f564f201 authored by DanmeiChen's avatar DanmeiChen
Browse files

fix crash for shared core

parent cabbdcc9
......@@ -2967,19 +2967,22 @@ LinphoneStatus linphone_core_start (LinphoneCore *lc) {
}
}
LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context, bool_t automatically_start) {
LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context, bool_t automatically_start, bool_t main_core) {
LinphoneCore *core = L_INIT(Core);
Core::create(core);
core->is_main_core = main_core;
linphone_core_init(core, cbs, config, userdata, system_context, automatically_start);
return core;
}
LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context, bool_t automatically_start) {
return _linphone_core_new_with_config(cbs, config, userdata, system_context, automatically_start, TRUE);
}
LinphoneCore *_linphone_core_new_shared_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context, bool_t automatically_start, const char *app_group_id, bool_t main_core) {
bctbx_message("[SHARED] Creating %s Shared Core", main_core ? "Main" : "Executor");
linphone_config_set_string(config, "shared_core", "app_group_id", app_group_id);
linphone_config_set_bool(config, "shared_core", "is_main_core", main_core);
LinphoneCore *core = _linphone_core_new_with_config(cbs, config, userdata, system_context, automatically_start);
core->is_main_core = main_core;
LinphoneCore *core = _linphone_core_new_with_config(cbs, config, userdata, system_context, automatically_start, main_core);
// allow ios app extension to mark msg as read without being registered
core->send_imdn_if_unregistered = !main_core;
getPlatformHelpers(core)->getSharedCoreHelpers()->registerSharedCoreMsgCallback();
......@@ -3020,12 +3023,6 @@ LinphoneCore *linphone_core_ref(LinphoneCore *lc) {
}
void linphone_core_unref(LinphoneCore *lc) {
#if TARGET_OS_IPHONE
if (lc->platform_helper) {
delete getPlatformHelpers(lc);
}
lc->platform_helper = NULL;
#endif
belle_sip_object_unref(BELLE_SIP_OBJECT(lc));
}
......
......@@ -128,7 +128,7 @@ static void sNetworkChangeCallback(CFNotificationCenterRef center, void *observe
const string IosPlatformHelpers::Framework = "org.linphone.linphone";
IosPlatformHelpers::IosPlatformHelpers (std::shared_ptr<LinphonePrivate::Core> core, void *systemContext) : GenericPlatformHelpers(core) {
mUseAppDelgate = (!getSharedCoreHelpers()->isCoreShared() || linphone_config_get_bool(core->getCCore()->config, "shared_core", "is_main_core", false)) && !linphone_config_get_int(core->getCCore()->config, "tester", "test_env", false);
mUseAppDelgate = core->getCCore()->is_main_core && !linphone_config_get_int(core->getCCore()->config, "tester", "test_env", false);
if (mUseAppDelgate) {
mAppDelegate = [[IosAppDelegate alloc] init];
[mAppDelegate configure:core];
......
......@@ -53,3 +53,6 @@ stun_server=stun.example.org
[misc]
hide_chat_rooms_from_removed_proxies=0
hide_empty_chat_rooms=0
[tester]
test_env=1
......@@ -227,7 +227,6 @@ static void shared_executor_core_get_message_by_starting_a_core(void) {
const char *text = "Bli bli bli \n blu";
LinphoneCoreManager *sender_mgr = linphone_core_manager_new_without_auto_iterate("marie_rc");
LinphoneCoreManager *receiver_mgr = linphone_core_manager_create_shared("pauline_rc", TEST_GROUP_ID, FALSE, NULL);
linphone_core_set_auto_iterate_enabled(receiver_mgr->lc, FALSE);
linphone_core_manager_start(receiver_mgr, TRUE);
const char *call_id = shared_core_send_msg_and_get_call_id(sender_mgr, receiver_mgr, text);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment