Bug Report T147995
Visible to All Users

cxDateEdit - An AV occurs when pressing the Left Arrow and Right Arrow keys while the cursor is positioned at the rightmost position of the selected edit value

created 11 years ago

We've had a few cases were DateEdit editors in TcxGridTableView views crash; it's generally rather intermittent and happens after moving the caret about inside the editor, but in the interests of sending you a test case I'd found a repeatable set of operations that'll lead to an exception.  If you take these steps in the EXE from the attached demo project:

Click in the top data cell; the text is selected
   Press Alt+Cursor Down; the calendar drops down
   Hit Esc; the calendar is hidden, and the text is selected
   Press Cursor Left; the carat is between the 1 and 4 of "2014"
   Press Cursor Up; no visible effect
   Press Cursor Right

…then on the final cursor key press there's an access violation.  A final right cursor key press seems to be a common factor every time we've seen the crash, but I'm fairly sure there are numerous other preceding key presses that'll get it in the state where it's about to crash.

Looking at the code where the crash happens (cxMaskEdit.pas):

Delphi
function TcxMaskEditRegExprExMode.PressRight: Boolean; var I: Integer; begin Result := True; CursorCorrection; Clear; if FEdit.SelLength > 0 then begin if (FEdit.CursorPos = FEdit.SelStart) and not FEdit.FShiftOn then begin FRegExpr.UpdateOn := False; inherited PressRight; Clear; FRegExpr.UpdateOn := True; Exit; end else if (FEdit.CursorPos = FEdit.SelStart + Fedit.SelLength) and not FEdit.FShiftOn then Exit; end; inherited PressRight; if FUpdate <> '' then begin for I := 1 to Length(FUpdate) do begin FHead := FHead + FTail[I]; FEdit.SendMyKeyDown(VK_RIGHT, []); end; Delete(FTail, 1, Length(FUpdate)); end; end;

…the exception's in the:

Delphi
FHead := FHead + FTail[I];

line - internally FUpdate = '//', FTail = '' (i.e. empty) so the loop reads outside the valid range of FTail.

Comments (2)
DevExpress Support Team 11 years ago

    Hello Ian,

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

      Thanks for the update Paulo

      Answers approved by DevExpress Support

      created 11 years ago (modified 11 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.

        Show previous comments (3)

          A quick followup to this Paulo - I've got the hotfix working with the v2013 vol 1.5 we're currently using, but checking version hotfix version numbers against the versions available for an unexpired subscription we have there seems to be a mismatch.
          The subscription offers downloads of:
            v2014 vol 1.4 (released yesterday),
            v2014 vol 1.3
            v2014 vol 1.2
            v2013 vol 2.7
            v2013 vol 2.6
            v2013 vol 2.5
            v2013 vol 2.4
            v2013 vol 2.3
            v2013 vol 2.2
          The hotfixes are for v2014 vol 1.5 and v2013 vol 2.8, both a point version higher than is available for download, or v2013 vol 1.9 which is presumably earlier than the download list runs to.
          Has the hotfix itself bumped the point version number up by one for the more recent ranges, or am I overlooking something here?

          DevExpress Support Team 11 years ago

            The hotfix version corresponds to the build version in which we are going to embed the corrected code. Usually such versions are not available at the time we publish fixes (otherwise, there would not be necessary to publish fixes). So, everything is correct here.

              Thanks for the update Paulo - it looks like this one's just a difference in terminology (if the corrected code's in the next version from the start I'd have viewed that version as simply fixed, without the need to publish a specific changed module ahead of time, whereas a hotfix would be for application to something that's been released already).
              In any case it is now working for me, so thanks again!

              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.