mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
node: wait for event loop to stop before freeing objects
This prevents segfaults during shutdown.
This commit is contained in:
@@ -371,6 +371,11 @@ NAPI_METHOD(dcn_context_unref) {
|
||||
|
||||
TRACE("Unrefing dc_context");
|
||||
dcn_context->gc = 1;
|
||||
dc_stop_io(dcn_context->dc_context);
|
||||
if (dcn_context->event_handler_thread != 0) {
|
||||
uv_thread_join(&dcn_context->event_handler_thread);
|
||||
dcn_context->event_handler_thread = 0;
|
||||
}
|
||||
dc_context_unref(dcn_context->dc_context);
|
||||
dcn_context->dc_context = NULL;
|
||||
|
||||
@@ -2922,6 +2927,11 @@ NAPI_METHOD(dcn_accounts_unref) {
|
||||
|
||||
TRACE("Unrefing dc_accounts");
|
||||
dcn_accounts->gc = 1;
|
||||
dc_accounts_stop_io(dcn_accounts->dc_accounts);
|
||||
if (dcn_accounts->event_handler_thread != 0) {
|
||||
uv_thread_join(&dcn_accounts->event_handler_thread);
|
||||
dcn_accounts->event_handler_thread = 0;
|
||||
}
|
||||
dc_accounts_unref(dcn_accounts->dc_accounts);
|
||||
dcn_accounts->dc_accounts = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user