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:
@ -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;
|
||||
|
Reference in New Issue
Block a user