diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 82d2ca6d4d8a369c59295d56566bd74d4d4e2ac0..ebc281ab0027a0cce6640c5cc9b4462bae6f39cc 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -1944,9 +1944,11 @@ int bitmap_drv_init(void (*drawrect_cb) (struct rectlist *data) pthread_mutex_unlock(&screenlock); pthread_mutex_unlock(&vstatlock); + pthread_mutex_lock(&callbacks.lock); callbacks.drawrect=drawrect_cb; callbacks.flush=flush_cb; callbacks.rects = 0; + pthread_mutex_unlock(&callbacks.lock); bitmap_initialized=1; _beginthread(blinker_thread,0,NULL); diff --git a/src/syncterm/ssh.c b/src/syncterm/ssh.c index 729bdf06fd12369b43ce0b003b01a017edc24dab..55655334961f50da3af30922d82162c68d823cd8 100644 --- a/src/syncterm/ssh.c +++ b/src/syncterm/ssh.c @@ -691,11 +691,13 @@ ssh_connect(struct bbslist *bbs) CRYPT_CONTEXT ssh_context; char *pubkey = NULL; - ssh_channel = -1; - sftp_channel = -1; if (!bbs->hidepopups) init_uifc(true, true); pthread_mutex_init(&ssh_mutex, NULL); + pthread_mutex_lock(&ssh_mutex); + ssh_channel = -1; + sftp_channel = -1; + pthread_mutex_unlock(&ssh_mutex); pthread_mutex_init(&ssh_tx_mutex, NULL); get_syncterm_filename(path, sizeof(path), SYNCTERM_PATH_KEYS, false); @@ -1021,7 +1023,10 @@ ssh_close(void) cryptSetAttribute(ssh_session, CRYPT_OPTION_NET_READTIMEOUT, 1); cryptSetAttribute(ssh_session, CRYPT_OPTION_NET_WRITETIMEOUT, 1); conn_api.terminate = 1; - close_sftp_channel(sftp_channel); + pthread_mutex_lock(&ssh_mutex); + int sc = sftp_channel; + pthread_mutex_unlock(&ssh_mutex); + close_sftp_channel(sc); close_ssh_channel(); ssh_active = false; while (conn_api.input_thread_running == 1 || conn_api.output_thread_running == 1 || pubkey_thread_running) {