There is probably an issue in the juce::ListBox class where the function getRowNumberOfComponent asks for the index of the component in the children of the ListViewport instead of asking it to the viewed component.
Simply changing the line 177
const int index = getIndexOfChildComponent (rowComponent);
const int index = getViewedComponent()->getIndexOfChildComponent (rowComponent);
do the job.