The problem is in using (static) lists in the tranches array; when adding a tranche to the array through wl_array_add()
, the memory reallocation in libwayland messes up the lists.
Adding a level of indirection to the lists solves the problem, the tradeoff being a bit more of memory management.