From: montnaro@ausable.crd.ge.com (Skip Montanaro)
Newsgroups: comp.windows.x.motif
Subject: Core dump if I double-click in a ScrolledList
Date: 11 Sep 92 20:18:26 GMT
Reply-To: montanaro@crd.ge.com (Skip Montanaro)
Organization: GE Corporate Research & Development, Schenectady, NY


I have a simple little application that mimics the FileSelectionBox (sort
of). The idea was to see how fast things actually might be made when
traversing the directory tree, since the FSB is so slow on large
directories.

In the directory list I set up a browseSelection callback to scan the
directory and update the directory and plain files lists. Unfortunately, I
had left my brains at home and was double-clicking instead of
single-clicking in the directory list. Most of the time things worked okay,
but when I double-clicked on a particular list element it would core dump.
(On the Sun-4 we're using Motif 1.1.3 or 1.1.4, I think - on the SGI we're
using whatever they deliver with IRIX 4.0.4. On our HP9k720 (HPUX 8.0.7), it
never dumped core.)

If I didn't sort the lists, things were okay. If I didn't turn off the lists
when updating them things were okay also. Furthermore, if I used Purify on
the Sun, it would complain mightily about array bounds read violations and
free memory read violations down in the bowels of Motif - but only if I
sorted the lists. If they were left unsorted, Purify was silent. It never
complained about anything else (and there were no suppressions in effect). I
poured over my sorting code, which has been stable for a couple years, but
could find nothing amiss. It did perform malloc's and free's, however, so it
did juggle the heap around a bit.

I finally concluded (perhaps erroneously) that the second button press was
getting dispatched when the directory list's window was unmapped and that
something was snapping because of that. Am I correct in this assumption? Is
this completely out of the realm of possibility?

I'd post the code, but it wasn't written in LYMB, an internal
object-oriented development system, not C.

In case it's of use some folks (perhaps at OSF?), here are the Purify
messages I'm seeing:

Error (abr): array bounds read violation:
  * This is occurring while in:
             DefaultAction (List.o; pc = 0x6fa9cc)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
             _XtMatchAtom (<shared library>; pc = 0xf6fd4d30)
             _XtTranslateEvent (<shared library>; pc = 0xf6fd594c)
             _XtFreeWWTable (<shared library>; pc = 0xf6f962ac)
  * Reading 4 bytes from 0xb2cb8c in the heap section
    41 bytes past end of a malloc'd block at 0xb2cb10 of 84 bytes.
  * This block was allocated by malloc called from:
             realloc (purify.o or p3.o; pc = 0x2b8c)
             XtRealloc (<shared library>; pc = 0xf6f80408)
             AddInternalElement (List.o; pc = 0x6f55e4)
             XmListAddItem (List.o; pc = 0x6fde28)
             motif_list_add_item (motif_list.o; line 142)
             _msg_send (msg.o; pc = 0x179c70)

----  Purify'd lymb-sun4  ----
Error (fmr): free memory read violation:
  * This is occurring while in:
             DefaultAction (List.o; pc = 0x6faa18)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
             _XtMatchAtom (<shared library>; pc = 0xf6fd4d30)
             _XtTranslateEvent (<shared library>; pc = 0xf6fd594c)
             _XtFreeWWTable (<shared library>; pc = 0xf6f962ac)
  * Reading 4 bytes from 0xb2b21c in the heap section
    12 bytes before start of a freed block at 0xb2b228 of 8 bytes.
  * This block was allocated by malloc called from:
             XtMalloc (<shared library>; pc = 0xf6f80378)
             XmStringDirectionCreate (XmString.o; pc = 0x7aba4c)
             XmStringLtoRCreate (XmString.o; pc = 0x7abbbc)
             XmStringCreateLtoR (XmString.o; pc = 0x7abdd4)
             motif_list_add_item (motif_list.o; line 141)
             _msg_send (msg.o; pc = 0x179c70)
  * This block was freed 141 calls to free ago.

----  Purify'd lymb-sun4  ----
Error (fmr): free memory read violation:
  * This is occurring while in:
             _is_short_length (XmString.o; pc = 0x7ab3d8)
             _read_header_length (XmString.o; pc = 0x7ab518)
             XmStringCopy (XmString.o; pc = 0x7ade5c)
             DefaultAction (List.o; pc = 0x6faa24)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
  * Reading 1 byte from 0xb2b21b in the heap section
    13 bytes before start of a freed block at 0xb2b228 of 8 bytes.
  * This block was allocated by malloc called from:
             XtMalloc (<shared library>; pc = 0xf6f80378)
             XmStringDirectionCreate (XmString.o; pc = 0x7aba4c)
             XmStringLtoRCreate (XmString.o; pc = 0x7abbbc)
             XmStringCreateLtoR (XmString.o; pc = 0x7abdd4)
             motif_list_add_item (motif_list.o; line 141)
             _msg_send (msg.o; pc = 0x179c70)
  * This block was freed 141 calls to free ago.

----  Purify'd lymb-sun4  ----
Error (fmr): free memory read violation:
  * This is occurring while in:
             _is_short_length (XmString.o; pc = 0x7ab3d8)
             _read_string_length (XmString.o; pc = 0x7ab554)
             XmStringCopy (XmString.o; pc = 0x7ade68)
             DefaultAction (List.o; pc = 0x6faa24)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
  * Reading 1 byte from 0xb2b21b in the heap section
    13 bytes before start of a freed block at 0xb2b228 of 8 bytes.
  * This block was allocated by malloc called from:
             XtMalloc (<shared library>; pc = 0xf6f80378)
             XmStringDirectionCreate (XmString.o; pc = 0x7aba4c)
             XmStringLtoRCreate (XmString.o; pc = 0x7abbbc)
             XmStringCreateLtoR (XmString.o; pc = 0x7abdd4)
             motif_list_add_item (motif_list.o; line 141)
             _msg_send (msg.o; pc = 0x179c70)
  * This block was freed 141 calls to free ago.

----  Purify'd lymb-sun4  ----
Error (fmr): free memory read violation:
  * This is occurring while in:
             _read_string_length (XmString.o; pc = 0x7ab578)
             XmStringCopy (XmString.o; pc = 0x7ade68)
             DefaultAction (List.o; pc = 0x6faa24)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
             _XtMatchAtom (<shared library>; pc = 0xf6fd4d30)
  * Reading 1 byte from 0xb2b21b in the heap section
    13 bytes before start of a freed block at 0xb2b228 of 8 bytes.
  * This block was allocated by malloc called from:
             XtMalloc (<shared library>; pc = 0xf6f80378)
             XmStringDirectionCreate (XmString.o; pc = 0x7aba4c)
             XmStringLtoRCreate (XmString.o; pc = 0x7abbbc)
             XmStringCreateLtoR (XmString.o; pc = 0x7abdd4)
             motif_list_add_item (motif_list.o; line 141)
             _msg_send (msg.o; pc = 0x179c70)
  * This block was freed 141 calls to free ago.

----  Purify'd lymb-sun4  ----
Error (fmr): free memory read violation:
  * This is occurring while in:
             bcopy (p3.o; pc = 0x7e8c)
             XmStringCopy (XmString.o; pc = 0x7ade90)
             DefaultAction (List.o; pc = 0x6faa24)
             UnSelectElement (List.o; pc = 0x6f94c8)
             _XtMatchAtom (<shared library>; pc = 0xf6fd3f30)
             _XtMatchAtom (<shared library>; pc = 0xf6fd4d30)
  * Reading 8 bytes from 0xb2b218 in the heap section
    16 bytes before start of a freed block at 0xb2b228 of 8 bytes.
  * This block was allocated by malloc called from:
             XtMalloc (<shared library>; pc = 0xf6f80378)
             XmStringDirectionCreate (XmString.o; pc = 0x7aba4c)
             XmStringLtoRCreate (XmString.o; pc = 0x7abbbc)
             XmStringCreateLtoR (XmString.o; pc = 0x7abdd4)
             motif_list_add_item (motif_list.o; line 141)
             _msg_send (msg.o; pc = 0x179c70)
  * This block was freed 141 calls to free ago.
--
Skip (montanaro@crd.ge.com)
Newsgroups: comp.windows.x.motif