I've found two bugs in List.c that are corrupting and/or crashing
multiple-selection lists. The first is in _XmListDeselectPos(),
line 2289 - a single loop statement that should be a block, both
for correctness and for symmetry with _XmListSelectPos():
List_SelectedIndices(w)[j] = List_SelectedIndices(w)[j + 1];
should be:
{
List_SelectedIndices(w)[j] = List_SelectedIndices(w)[j +
1];
if (List_SelectedItems(w))
List_SelectedItems(w)[j] = List_SelectedItems(w)[j + 1];
}
------------------------------------------------------------------
The second bug is in _XmListInvokeCallbacks(), where a copy of
the selected items is made before calling the callbacks and is freed
afterward on the basis of an updated count, which means that the
copy may not be freed correctly - line 2348 should be preceded by:
int saved_items_count;
line 2431 should be preceded by:
saved_items_count = List_SelectedItemCount(w);
and line 2457 should be replaced with:
for (i = 0; i < /* List_SelectedItemCount(w) */ saved_items_count;
i++)