amiga-mui / muidev

:mage_man: Magic User Interface (MUI) – Documentation+Releases
http://muidev.de
55 stars 0 forks source link

MUIV_Listtree_GetEntry_Position_Previous crashes #325

Closed afalkenhahn closed 3 years ago

afalkenhahn commented 3 years ago

Check out the attached demo program. Select the item "bla2" and hit the button. On OS4 MUI will crash.

main.txt demo.txt

tboeckel commented 3 years ago

OMG! That bug must be ancient! The supplied node value MUIV_Listtree_GetEntry_ListNode_Active has never been converted to a real node pointer internally and is used "as is" when trying to find the previous node.

tboeckel commented 3 years ago

Fixed in the next nightly build (as soon as these are done again). Listtree_21_37.zip

afalkenhahn commented 3 years ago

Thanks, the new Listtree solves this problem but now iterating through the listtree using MUIM_Listtree_GetEntry crashes here. Have you made any changes to that? Maybe it's also related to the fact that I'm mixing the new Listtree.mcc with my MUI installation which was built on 21 January 2021 so maybe you can provide a complete build and I'll see if MUIM_Listtree_GetEntry still crashes. If you have made any changes to MUIM_Listtree_GetEntry after 21 January, though, they are probably the cause and need fixing...

tboeckel commented 3 years ago

Erm, of course I did modify MUIM_Listtree_GetEntry. That is the central method of your example code to trigger the crash. The changes are absolutely unrelated to any possible changes in MUII itself. The change just converts the special MUIV_Listtree_GetEntry_XXX values to real treenode pointers. If a real treenode pointer is passed to MUIM_Listtree_GetEntry this remains unchanged.

I can run this code without any problems:

tn = tn2;
do
{
    printf("%08lx\n", tn);
    tn = (APTR)DoMethod(lt, MUIM_Listtree_GetEntry, tn, MUIV_Listtree_GetEntry_Position_Next, 0);
}
while(tn != NULL);
printf("done\n");

tn2 is the first child node "bla1" from your example.

Or how do you iterate over the treenodes?

afalkenhahn commented 3 years ago

Sorry, for the previous comment, some sort of blackout, of course you had to modify MUIM_Listtree_GetEntry :) But it's definitely broken. Check out the attached code. It can't even query the first node... it returns NULL! main.txt

afalkenhahn commented 3 years ago

Btw, is there any way to attach source code without renaming it as a txt file?

tboeckel commented 3 years ago

Yes, you are right. When using the root node it is converted too early and hence treated as a normal node which then gives the wrong result.

I think source code is best attached a .zip Archive.

tboeckel commented 3 years ago

Listtree_21_38.zip