February 22nd, 2012, 11:52 PM
I get an access violation with the composite reports. It previews fine. Can print it fine as well. As soon as I destroy it (free and nill it) I get an access violation. IOf I keep the form open I get an access violation as soon as I exit the program.
Any ideas. Use to work on the previous version of quick reports (5.0)
This is my code
report2 := nil;
The composite report is on report 2. And on the composite report ONADDREPORTS events I have the following
I get the access violation on the freenandnil(report1). If I remove those codes then I get the violation on the MAIN FORM exit. If I preview them one by one it works fine.
Please can you help me.
February 23rd, 2012, 11:07 AM
I don't know enough about quick reports to offer specific advice. However, generically, it looks as if you
are freeing something after it has already been freed.
Either you may be doing it or Quick Reports may be freeing it after you.
February 23rd, 2012, 10:46 PM
Thanks Clive.I thought its something like that. But what is weird if i leave the freeand nill out all is fine. But when i close the form on wich the report runs i get another access violation. Its just weird!
February 24th, 2012, 11:09 AM
They are always weird until you find the cause
The issue with Access violations is that they do not manifest themselves when the problem
is created. They only show up when you try to access the memory that has been compromised.
February 25th, 2012, 04:33 PM
I haven't worked with quick reports either, but I'm not sure I understand your creation / destruction order, but I'm pretty sure you don't have to actually manually destroy the objects you create.
By making the application the owner, the application is responsible for freeing the object. You should be able to replace it with "Self" which would be a reference to the form, so that would make the form responsible to free the objects.