SetReportProperty causing "Invalid Pointer Operations"
Hello,
I would like to thank Nico for his help in previous problems. This one,
seems tougher.
Using D7. The program sets a report property at run-time. This is because
the same report is shared by two apps. It was built in the other app, and I
have instuctions to not change a single line unless necessary. So, building
on what was done in the prior version of this software, I am linking to the
report with:
sbrElev.SetReportProperty([shared report name]);
If I leave this line intact (as it used to be), then when shutting down the
form that calls the report, I get an invalid pointer operation. Debug DCUs
show this is happening in system.pas in the _freemem routine. Specifically,
result:= MemoryManager.freemem(p);
if result <> 0 then
error(reInvalidPointerOp);
The program seems to be trying to free memory that is already freed or was
never allocated. I also get an AV when shutting down the whole program. If
I comment out the SetReportProperty line, then the form closes just fine and
the program exits without a whimper. Which makes me think that whatever is
causing the problem comes form the SetReport method. Stepping through the
call stack takes forever. As far as I can tell, all code relevant to the
shared report is copied over. Any ideas on what might be attempting to free
twice or not yet allocated memory? Or is more information required from me?
I would like to thank Nico for his help in previous problems. This one,
seems tougher.
Using D7. The program sets a report property at run-time. This is because
the same report is shared by two apps. It was built in the other app, and I
have instuctions to not change a single line unless necessary. So, building
on what was done in the prior version of this software, I am linking to the
report with:
sbrElev.SetReportProperty([shared report name]);
If I leave this line intact (as it used to be), then when shutting down the
form that calls the report, I get an invalid pointer operation. Debug DCUs
show this is happening in system.pas in the _freemem routine. Specifically,
result:= MemoryManager.freemem(p);
if result <> 0 then
error(reInvalidPointerOp);
The program seems to be trying to free memory that is already freed or was
never allocated. I also get an AV when shutting down the whole program. If
I comment out the SetReportProperty line, then the form closes just fine and
the program exits without a whimper. Which makes me think that whatever is
causing the problem comes form the SetReport method. Stepping through the
call stack takes forever. As far as I can tell, all code relevant to the
shared report is copied over. Any ideas on what might be attempting to free
twice or not yet allocated memory? Or is more information required from me?
This discussion has been closed.
Comments
Take a look at the following example of loading subreports by reference.
This uses the SetReportProperty similarly to the way you are using it in
your app. One item that may be causing the error is that the subreports
still have a reference to the report object after the report object is
freed. Be sure to set the report property back to nil before closing your
application.
http://www.digital-metaphors.com/tips/SubReference.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com