How to reproduce:
1. Set icon size to 24.
2. Set panel size to 58.
3. Turn off window grouping in taskbar.
4. Open a lot of windows.
Now you should see incorrect wrapping done by icon grid. Only the first row has buttons.
5. Close some of the windows.
6. Kill the panel and restart it
Sometimes you can see some task buttons moved to the next row even when the first row has enough space.