1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 06:26:44 +02:00

Dynamically allocate audio calls structure

This fixes a bug that caused a segfault when attempting to call a friend with a
friend number above the MAX_CALLS limit
This commit is contained in:
jfreegman
2017-11-20 07:02:56 -05:00
parent db7c9fe426
commit fe6a7074ea
4 changed files with 59 additions and 7 deletions

View File

@ -466,6 +466,10 @@ void friendlist_onFriendAdded(ToxWindow *self, Tox *m, uint32_t num, bool sort)
if (sort)
sort_friendlist_index();
#ifdef AUDIO
init_friend_AV(i);
#endif
return;
}
}
@ -605,6 +609,10 @@ static void delete_friend(Tox *m, uint32_t f_num)
Friends.max_idx = i;
realloc_friends(i);
#ifdef AUDIO
del_friend_AV(i);
#endif
/* make sure num_selected stays within Friends.num_friends range */
if (Friends.num_friends && Friends.num_selected == Friends.num_friends)
--Friends.num_selected;