Bug Report T206728
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Layout View - An AV occurs when recreating a form that contains the grid control with this View

Setting a TcxGridDBLayoutView's Controller.Customization to True trows an Integer Overflow

created 10 years ago

In Version 4.2.3, programmatically setting a TcxGridDBLayoutView's Controller.Customization to True trows an Integer Overflow.

Worked perfectly in 4.2.2

The error seems to come from (unsure) :

unit dxComCtrlsUtils;

procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
var
  I: Integer;
begin
  for I := 0 to ATreeView.SelectionCount - 1 do
    AList.Add(ATreeView.Selections[I].Data);
end;

Show previous comments (1)

    Paulo,
    I haven't been able to reproduce _Excatly_ the problem I described but, I managed to create a sample program that clearly shows a problem (attached).
    In order to reproduce the problem, run the program, click the Customize button once, then click OK. Repeat a few times (customize then OK). You should have an access violation error after 4-5 retry.

      I found something interesting in dxComCtrlsUtils.pas (line ~ 200)
      The original code is :
      Procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
      var
       I: Integer;
      begin
           for I := 0 to ATreeView.SelectionCount - 1 do
              AList.Add(ATreeView.Selections[I].Data);
      end;
      In some cases, ATreeView.SelectionCount yields 0 (zero). So ATreeView.SelectionCount - 1 yields -1 throwing the Integer Overflow error.
      Here's the correction I applied to the code to fix the problem. I hope it'll help you guys !
      Procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
      var
       I: Integer;
      begin
        if ATreeView.SelectionCount > 0 then begin // Check if larger than 0
           for I := 0 to ATreeView.SelectionCount - 1 do begin
              AList.Add(ATreeView.Selections[I].Data);
           end;
        end;
      end;

      DevExpress Support Team 10 years ago

        Hello Stephan,

        Thank you for your sample project. I have reproduced the described behavior and forwarded this ticket to our developers for research.

        Answers approved by DevExpress Support

        created 10 years ago (modified 10 years ago)

        This problem seems to be fixed in the context of the Layout View - An AV occurs when recreating a form that contains the grid control with this View ticket.

          Show previous comments (6)

            Paulo,
            I understand your problem. I managed to create a smaller test program without any link to third party libraries (I hope).
            I found something interesting though : If I build the project by putting all DCU files in a DCU folder (located in the project's directory), I have the problem. If, in my project properties (Menu Project -> Options -> Delphi Compiler), I remove the path in "Unit output directory", then it works !
            I have no idea why !!
            Here's the small project (attached file). Run it (Cameleon.exe), then select "DevExpress -> Layout Bug Test" from the menu and click the "Customize" button.
            Now, if you want to compile it, make sure to change the path for the DCU. Compile with and without putting the DCUs in the DCU folder. Run the program with each settings and see if you encounter the problem (Integer Overflow).

            DevExpress Support Team 10 years ago

              Hello Stephan,

              Thank you VERY much for your simplified project. The problem seems to be unrelated to the one initially discussed here. I created a separate ticket on your behalf (The "Integer overflow" exception) and forwarded it to our developers for research…

                Thank you Paulo.
                I do hope that the two ticket I created and that you've been able to reproduce will be fixed in the upcoming release.
                Regards,
                Stephan

                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.