Einzelnen Beitrag anzeigen

peterbelow

Registriert seit: 12. Jan 2019
Ort: Hessen
700 Beiträge
 
Delphi 12 Athens
 
#10

AW: Delphi 12: Fehler mit Action := caFree

  Alt 2. Dez 2023, 13:15
I am out of words and at loss of straight thinking !
WTF is that stack ?
Did Embarcadero completely redesigned the TApplication in VCL ? and butchered it in the process ?
In D12 they completely reworked the support for MDI UIs to allow all the modern features users expect on Win 10 and 11. There probably are a lot of legacy MDI programs around that are in dire need of updating and from Embarcadero customers with some clout ...

This Visual manager thing was appearendly introduced to implement this support, but they introduced a bug in the process as well.
At the very end of TCustomForm.WndProc there are these lines:

Delphi-Quellcode:
  inherited WndProc(Message);

  if VisualManager_AcceptMessage(Message) then
    VisualManager_WndProc(Message);
end;
Closing a secondary form with an OnClose handler that sets caFree as close action eventually calls TCustomform.Release, which posts a CM_RELEASE message to the form. The inherited WndProc call above passes that to the CMRelease message handler, which Frees the form instance. So the form self reference is invalid when VisualManager_AcceptMessage is called, and since that method tries to read a field of the form it blows up.
Peter Below
  Mit Zitat antworten Zitat