I have a problem when using asl filerequester in my program. My requester is a multiselect, and works fine when I only select files, but if I only choose drawers, the program crashes and I get a recoverable alert.
What I have found out is that the crash happens when i use ´FreeAslRequest()´ .
If I don´t free the requester I am okay, but it should not be like that.
Anyone experienced the same or have an explanation on this.
Re: asl/getfile requester
Posted: Sun Apr 01, 2012 8:51 am
by tonyw
Without looking up the docs, the first things I would do:
1) Use the debug kernel. It will spit out more useful information when you have a crash. It might even make your program crash earlier, which would be useful.
2) Capture the crash log somehow. The best way is to capture it on a serial terminal.
3) Add the options "serial" and "munge" to the os4 command line, eg "os4_commandline = 'serial munge debuglevel=0'".
4) Do whatever you do to cause the crash then look at the DAR in the crash log.
If the DAR is 0x00000000 (or thereabouts), then you have accessed a null pointer (and you will see ABADCAFE in one or more registers).
If the DAR is 0xDEADBEEF (or thereabouts), then you have accessed some memory after it has been freed.
If the DAR is 0xCCCCCCCC (or thereabouts), then you have tried to free a Node a second time.
If you post the first part of the crash log here (not all the system data or library information, please!), we can help you debug it.
Re: asl/getfile requester
Posted: Sun Apr 01, 2012 3:46 pm
by mcleppa
Thanx, here's the Crashlog and I try some more debugging
Crash log for task "music-tagger"
Generated by GrimReaper 53.2
Crash occured in module kernel at address 0x0140F0DC
Type of crash: program exception
Hmmm, not much useful info there. That's the problem with the GR's crashlog - it's too late. The output to the serial port (before the GR requester appears) often has more information. You can get it on another machine via a serial cable or store it somewhere using Sashimi.
You could post the code here if you like. Use the "Hidden text" tags so it fits on the page.
Re: asl/getfile requester
Posted: Mon Apr 02, 2012 10:06 am
by mcleppa
I have stripped down the program to a single window and a button to open the filerequester.
What I have found out is that the crash happens when i use ´FreeAslRequest()´
You seem to be mixing up different things. If you create the file requester as a BOOPSI object (through getfile.gadget) and invoke it via a method, you shouldn't need AllocAslRequest() / FreeAslRequest() at all. Getfile.gadget wraps object-oriented code around asl.library and handles the asl data structure allocations/deallocations automatically and internally: DisposeObject(gadgets[GID_FILEREQUESTER]) calls FreeAslRequest() for you, so any subsequent call to the function will naturally produce a crash because memory for the requester data structure has already been freed.
Re: asl/getfile requester
Posted: Mon Apr 02, 2012 12:01 pm
by mcleppa
Hei, sorry about my mixup, my example here uses getfile.gadget and I free it using DisposeObject(), as I believe should be right according to autodocs.
But the same crash happens when I use asl requester and use AllocAslRequest() / FreeAslRequest().
Re: asl/getfile requester
Posted: Tue Sep 17, 2013 9:52 am
by mcleppa
I had to open this post again, since I now believe there is a bug in asl.
I have used an example from amigaos wiki documentation and the same fault happens with this.
The following happens: when using the 'DoMultiSelect' option it causes the system to get a 'Recoverable Alert'. It happens when you select more than one drawer. But if you start up program again after the 'Alert' and select the same amount of drawers, it works ok. But selecting more drawers next time again will cause the same 'alert'. The program is printing the output to screen and sometimes it prints only 'rubbish' on some Drawer/File names. The crash happens always when calling AslFreeRequest().
Would appreciate if anyone more experienced could have a look into this.
Re: asl/getfile requester
Posted: Tue Sep 17, 2013 12:26 pm
by salass00
@mcleppa
Is the alert this one?
#define AN_FreeTwice 0x01000009UL /* Freeing memory already freed */
I compiled and ran your program and it seemed to work fine on my beta system at least. There was a bug fixed in asl.library V53.48 (19.8.2013) that might be the cause of your problem.
In the future it might be a good idea to state the alert code rather than just saying that there was an alert as it may be useful information in finding the problem.
Edit:
Just tried on my non-beta system and it produced the AN_FreeTwice alert so yes it is likely the bug I fixed in asl.library V53.48.
Re: asl/getfile requester
Posted: Tue Sep 17, 2013 1:32 pm
by salass00
@mcleppa
I just managed to reproduce FreeAslRequest() crash. It seems there may be more than one bug involved here...
I don't have time to look into it right now but I will later.