mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +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
|
||||
- set a default error if NDN does not provide an error
|
||||
- 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
|
||||
- python: added `Message.get_status_updates()` #3416
|
||||
|
||||
@@ -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