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:
@@ -9,6 +9,7 @@
|
|||||||
### Fixes
|
### Fixes
|
||||||
- set a default error if NDN does not provide an error
|
- set a default error if NDN does not provide an error
|
||||||
- python: avoid exceptions when messages/contacts/chats are compared with `None`
|
- python: avoid exceptions when messages/contacts/chats are compared with `None`
|
||||||
|
- node: wait for the event loop to stop before destroying contexts #3431
|
||||||
|
|
||||||
### API-Changes
|
### API-Changes
|
||||||
- python: added `Message.get_status_updates()` #3416
|
- python: added `Message.get_status_updates()` #3416
|
||||||
|
|||||||
@@ -371,6 +371,11 @@ NAPI_METHOD(dcn_context_unref) {
|
|||||||
|
|
||||||
TRACE("Unrefing dc_context");
|
TRACE("Unrefing dc_context");
|
||||||
dcn_context->gc = 1;
|
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);
|
dc_context_unref(dcn_context->dc_context);
|
||||||
dcn_context->dc_context = NULL;
|
dcn_context->dc_context = NULL;
|
||||||
|
|
||||||
@@ -2922,6 +2927,11 @@ NAPI_METHOD(dcn_accounts_unref) {
|
|||||||
|
|
||||||
TRACE("Unrefing dc_accounts");
|
TRACE("Unrefing dc_accounts");
|
||||||
dcn_accounts->gc = 1;
|
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);
|
dc_accounts_unref(dcn_accounts->dc_accounts);
|
||||||
dcn_accounts->dc_accounts = NULL;
|
dcn_accounts->dc_accounts = NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user