Hello to all,
The problem is related with floating panels. As you can see in the attached sample application, I place in the main form one dock panel in a dock site. The main form creates a second form in order to be placed in the refered dock panel.
If we start the application and then close it, nothing happend, that is, no errors occur. However, if we place the dock panel "floating", and then try to close the application an "Invalid operation" is raised.
The "rare" thing is I am try with FastMM4 in full debug mode, and, apparently, the second form no need to be freed when the main form is destroying (?). That is, no matter if the dock panel is floating or not, if we simply don't free the second form, no errors or memory leaks appears, even using FastMM4 in full debug mode.
But hey,... we creates the second form and we are the responsible to free it... and in fact this is what happend in previous releases.
I use dock panels in my application from long time ago, and I can perfectly remember how I can float the panels and close the application without problems, even when I free my "dock forms", since I create it before.
For this reason I think this is an error or a "new" and rare behaviour (to me) in the latest release of the Docking components.
What do you think about? Please, try the attached application and tell me if you can reproduce this problem... or if I am wrong...
Thanks very much in advance.
Continue looking at this issue, maybe I am not right when say the problem was introduced by a recent Docking components release. In fact, I can remember I place the "dock forms free" code into the Close event, and not in the Destroy event of the main form.
In fact I try right now and, if we place the code into the Close event instead the Destroy event, no errors occur. Another workaround can be to assign a owner to the dock forms, however, I am not sure if this last approach can be always suitable.
However, even when I can place the code in the Close event instead the Destroy event, why this error occur? Why only when floating panels? Why I can't place such code in the Destroy event? Maybe anyone can tell me in what I am wrong...
Thanks again in advance!
Well. Certainly I know what the problem is and can imagine why the problem occur. And yes, there is no problem to use the Close event instead the Destroy event in my main form.
Probably I only need another person (like you) tell me what really happend and that this is the expected behaviour and why. So thanks very much Eugene for your information.
Thanks again and have a nice day Eugene!