NOTE: The bug that produces the warning exists
in the unmodified List.c as well.
----- Original Message -----
From: Jerry Miller <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 23, 2001 12:25 PM
Subject: Re: Bugs in _XmListDeselectPos() and _XmListInvokeCallbacks()
> Although the fixes described in my previous e-mail, especially the
> second one, correct the crashing problem, there is the problem
> of seemingly redundant calls to _XmListDeselectPos() for the
> same position, which are not handled correctly. Upon deselecting
> all items prior to unmanaging the list - a process that works
> correctly under OSF Motif - I get a warning for the last selected
> position:
>
> Warning:
> Name: PreTransform Test List
> Class: XmList
> XmListDeselectPos(377) : item not found in selectedItems.
>
> I haven't yet been able to determine the cause of this problem,
> but backing out the first recommended fix (at line 2289) did not
> correct it, so it's apparently an existing problem that was hidden
> by the previous more serious memory error and thus never fixed.
>
> ----- Original Message -----
> From: Jerry Miller <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 23, 2001 11:25 AM
> Subject: Bugs in _XmListDeselectPos() and _XmListInvokeCallbacks()
>
>
> > 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++)
> >
>