Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug, and clear a debug assert #12

Merged
merged 1 commit into from
Jan 13, 2019
Merged

Conversation

irwir
Copy link
Contributor

@irwir irwir commented Jan 12, 2019

  1. Fix a dangerous bug in CResizableLayout::AddAllOtherAnchors
    ::GetClassName(hWnd, szClassName, _countof(szClassName))
    The third parameter is a character count, not a byte count.
    In Unicode builds sizeof would give twice the length of the name buffer; and access violations might be expected; especially with a small buffer.
    Not necessarily, but to make the code suitable for prehistoric VS versions, _countof(x) might be replaced with sizeof(x)/sizeof(x[0]).

  2. Clear a rare debug assert in CResizableFormView::GetTotalClientRect
    A trivial sequence "remove anchor - set window placement - add anchor" was fine in the first pass, but fired a debug asserts afterwards. The problem was in an attempted access to a non-existent scrollbar. An early check and return fixed this.
    GetDeviceScrollSizes treats all non-positive mapping modes as invalid, and the condition nMapMode < 0 was changed accordingly.

Clear a rare debug assert in CResizableFormView::GetTotalClientRect
@irwir irwir changed the title Fix a bug, and clear debug assert Fix a bug, and clear a debug assert Jan 13, 2019
@ppescher ppescher merged commit 17ff389 into ppescher:master Jan 13, 2019
@ppescher
Copy link
Owner

Thanks @irwir
I'm no longer accustomed to writing good Unicode-compatible Windows code.
That probably comes from programming small microcontrollers, where wchar_t is a luxury you never have to deal with.

@irwir irwir deleted the updates branch September 21, 2019 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants