Ilkka Lehtoranta schrieb:
> On Mon, 26 Feb 2007, Andreas Falkenhahn wrote:
>
>> Hi,
>>
>> not sure if this is a bug: It seems that NList actually writes to the hook
>> specified in
>> MUIA_NList_ConstructHook or MUIA_NList_DestructHook. I always declared my
>> hooks as "static const struct Hook" but that crashes under OS4 final. I have
>> to
>> remove the "const" from the declaration. Then it works with NList.
>>
>> With the List class from MUI, "const" hooks work fine. So I would argue for a
>> fix in NList here.
>
> Hook should not be declared const because of struct MinNode.
You are right. Let me explain it more in detail. Have a look at the
definition of a "struct Hook":
-- cut here --
struct Hook
{
struct MinNode h_MinNode;
ULONG (*h_Entry)(); /* assembler entry point */
ULONG (*h_SubEntry)(); /* often HLL entry point */
APTR h_Data; /* owner specific */
};
-- cut here --
As you can see a "struct Hook" is nothing more than a "struct MinNode"
plus some addition function pointers and data pointers.
As Ilkka outlined, due to the "struct MinNode" such a hook can normally
be added to a "struct List" like a common list node. However, this means
that exec.library has to manipulate the minnode while adding it to the
corresponding list.
But as you have defined the hook as "const", that would end up in an
illegal access and may crash you system. So yes, a struct Hook should
_never_ be defined as "const" - well, as long as it isn't added to a
list. But as you have noticed, NList is exactly doing that.
cheers,
jens
--
Jens Langner Ph: +49-172-4452254
Rißweg 27b
01324 Dresden [EMAIL PROTECTED]
Germany http://www.jens-langner.de/
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/0It09A/bOaOAA/yQLSAA/16uqlB/TM
--------------------------------------------------------------------~->
Visit http://www.amiga.dk/tumult for MUI-related
information, especially about MUI custom classes.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MUI/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/MUI/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/