mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-15 04:43:03 +01:00
fix race conditions
This commit is contained in:
parent
22acba5aa8
commit
f8ff5df2f3
@ -783,7 +783,9 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
mvwvline(ctx->sidebar, 0, 0, ACS_VLINE, y2 - CHATBOX_HEIGHT);
|
mvwvline(ctx->sidebar, 0, 0, ACS_VLINE, y2 - CHATBOX_HEIGHT);
|
||||||
mvwaddch(ctx->sidebar, y2 - CHATBOX_HEIGHT, 0, ACS_BTEE);
|
mvwaddch(ctx->sidebar, y2 - CHATBOX_HEIGHT, 0, ACS_BTEE);
|
||||||
|
|
||||||
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
int num_peers = groupchats[self->num].num_peers;
|
int num_peers = groupchats[self->num].num_peers;
|
||||||
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
wmove(ctx->sidebar, 0, 1);
|
wmove(ctx->sidebar, 0, 1);
|
||||||
wattron(ctx->sidebar, A_BOLD);
|
wattron(ctx->sidebar, A_BOLD);
|
||||||
@ -803,11 +805,16 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
/* truncate nick to fit in side panel without modifying list */
|
/* truncate nick to fit in side panel without modifying list */
|
||||||
char tmpnck[TOX_MAX_NAME_LENGTH];
|
char tmpnck[TOX_MAX_NAME_LENGTH];
|
||||||
int maxlen = SIDEBAR_WIDTH - 2;
|
int maxlen = SIDEBAR_WIDTH - 2;
|
||||||
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
memcpy(tmpnck, &groupchats[self->num].peer_names[peer * TOX_MAX_NAME_LENGTH], maxlen);
|
memcpy(tmpnck, &groupchats[self->num].peer_names[peer * TOX_MAX_NAME_LENGTH], maxlen);
|
||||||
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
tmpnck[maxlen] = '\0';
|
tmpnck[maxlen] = '\0';
|
||||||
|
|
||||||
/* TODO: Make this not poll */
|
/* TODO: Make this not poll */
|
||||||
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
uint8_t status = tox_group_get_status(m, self->num, i);
|
uint8_t status = tox_group_get_status(m, self->num, i);
|
||||||
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
int colour = WHITE;
|
int colour = WHITE;
|
||||||
|
|
||||||
if (status == TOX_GS_AWAY)
|
if (status == TOX_GS_AWAY)
|
||||||
|
Loading…
Reference in New Issue
Block a user