mirror of
				https://github.com/Tha14/toxic.git
				synced 2025-10-31 05:36:51 +01:00 
			
		
		
		
	fix race conditions
This commit is contained in:
		| @@ -783,7 +783,9 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m) | ||||
|         mvwvline(ctx->sidebar, 0, 0, ACS_VLINE, y2 - CHATBOX_HEIGHT); | ||||
|         mvwaddch(ctx->sidebar, y2 - CHATBOX_HEIGHT, 0, ACS_BTEE); | ||||
|  | ||||
|         pthread_mutex_lock(&Winthread.lock); | ||||
|         int num_peers = groupchats[self->num].num_peers; | ||||
|         pthread_mutex_unlock(&Winthread.lock); | ||||
|  | ||||
|         wmove(ctx->sidebar, 0, 1); | ||||
|         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 */ | ||||
|             char tmpnck[TOX_MAX_NAME_LENGTH]; | ||||
|             int maxlen = SIDEBAR_WIDTH - 2; | ||||
|             pthread_mutex_lock(&Winthread.lock); | ||||
|             memcpy(tmpnck, &groupchats[self->num].peer_names[peer * TOX_MAX_NAME_LENGTH], maxlen); | ||||
|             pthread_mutex_unlock(&Winthread.lock); | ||||
|             tmpnck[maxlen] = '\0'; | ||||
|  | ||||
|             /* TODO: Make this not poll */ | ||||
|             pthread_mutex_lock(&Winthread.lock); | ||||
|             uint8_t status = tox_group_get_status(m, self->num, i); | ||||
|             pthread_mutex_unlock(&Winthread.lock); | ||||
|  | ||||
|             int colour = WHITE; | ||||
|  | ||||
|             if (status == TOX_GS_AWAY) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user