Bug Report T165495
Visible to All Users

An AV occurs when closing an application while the Customization Form is open if the OnCustomization event handler accesses the layout container

created 10 years ago

Hi,

If I close my app when the layout controls customization form is active, and I have an OnCustomization event handler assigned, it will cause an AV.

Open the attached app, hit the customize button, then close the main form.

It is crashing due to the code in OnCustomization:

procedure TForm7.dxLayoutControlCustomization(Sender: TObject);
begin
  if dxLayoutControl.Customization then begin  <— crash is here
     // dlg opened…
     dxLayoutControl.CustomizeFormTabbedView := true;
  end
  else begin
     // dlg was closed, update stuff…
     ReAlignChildCaptions(lgClient);
  end;
end;

I can understand that things are being destroy so checking dxLayoutControl.Customization is attempting to create a window handle and hence the crash.

Is this a DX bug, or my bad code design?

I really need to know when the customization form has closed so I can re-wrangle my layout groups/items as I want. And that has to happen before the entire layout is streamed away. See my prior question: https://www.devexpress.com/Support/Center/Question/Details/T165479 This is the only place I could see to do this. Although I will probably need to subclass the customization form to do it better (eg my changes are applied in real-time, rather then waiting until the customization form is closed)

Yes, I realize I could check App.terminated and avert the AV but then I've missed my objective. IMHO the event handler should trigger, I do my custom code, and the app then proceeds to shutdown.

If DevExpress does not consider this to be a bug, is it documented somewhere that the developer should always check application.terminated in this event handler? One could also argue that this event handler should not be called at all if the application is terminating as the developer cannot do anything with the layout controls at that stage.

regards,
-randall

Comments (2)

    Shot - it just occurred to me that this will not compile for you… Open the DFM and replace "bw" with "cx" if you want to keep those grid around. Or just replace them with TPanels. And you can remove bwShared and bwSharedCX from the USES list and anything else that is "bw" specific.
    sorry about that :(
    -randall

    DevExpress Support Team 10 years ago

      Hello,
      I have reproduced this problem. I am forwarding this issue to our developers for further processing.

      Answers approved by DevExpress Support

      created 10 years ago

      We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

      Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.