It turns out, after some further debugging, that the warning
is the result of the following pair of statements in my module:

XmListReplaceItemsPos(w,&item,1,pos+NUM_TEMPLATES);
XmListDeselectPos(w,pos+NUM_TEMPLATES);

According to O'Reilly's description of the first function, the second
does appear to be redundant, although it does no harm and makes
my deselection function symmetrical to my selection function, in which
I use the following pair:

XmListReplaceItemsPos(w,&item,1,pos+NUM_TEMPLATES);
XmListSelectPos(w,pos+NUM_TEMPLATES,False);

(The need for XmListReplaceItemsPos is that my selection process
is both horizontally and vertically positional, so that the string changes
to indicate which of two or three horizontal selection options was
selected via XQueryPointer() and resets upon deselection.)

----- 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++)
> >
>

Reply via email to