Page 1 of 1

Scalerichview and action load with other form

Posted: Sun Oct 13, 2013 10:56 pm
by RobertoVG
Two strange situations involving release memory resources with ScaleRichview and Action

place the form in the example ... ScaleRichView \ Demos \ ActionTest ( form3 ) loaded as fsNormal through another form1 ( for example) .

In onClose method to terminate the form3 and release it from memory , put
action : = caFree .

when the form3 is closed , it generates an exception .
If the action statement : = caFree is removed , there is no exception.

If this example were any other simple form without using ScaleRichView and action ( eg form 4 ) , to shut it down with the action statement : = caFree not occur excption and form 4 is effectively removed from memory.

This indicates that the form3 ( ScaleRichView and actions ) contains instructions as to close the form would be released from memory . But this does not happen ! After closing the form3 if you instruct to form3.visible : = true , and form3.show the form3 is being shown .

So the question is how to effectively remove the form3 memory when loaded into another form ?

Why is not free from memory ?

When you created this example using actions (srvActionsResource in the form3), and to end the close form is not necessary to release it from memory? Why?

The most curious is that the memcheck (*see instruction below*) report memory leak from srvActionsResource. You know the reason?

(*
program ActionTest;
uses
MemCheck,
Forms,
dmActionsSRV in 'dmActionsSRV.pas' {srvActionsResource: TDataModule},
Unit3 in 'Unit3.pas' {Form3};
{$R *.res}
begin
MemChk; *)

Posted: Sun Oct 13, 2013 11:59 pm
by RobertoVG
correction of the previous message:

The most curious is that the memcheck (*see instruction below*) DO NOT report memory leak from srvActionsResource. You know the reason?

Posted: Mon Oct 14, 2013 5:53 am
by Sergey Tkachenko
My guess: if you used ActionTest form with ScaleRichView, it assigns Application.OnHint. The procedure assigned to Application.OnHint refers to the status bar control on this form.
If the form is destroyed, any attempt to display hint will lead to exception.

Solution - assign Application.OnHint := nil when closing the form.

exception - Applications Hint after close Form with caFree

Posted: Mon Oct 14, 2013 11:12 am
by RobertoVG
I confirm that you resolved the issue.

Thanks!