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 crash when dragging in wxAuiNotebook #24039

Merged
merged 4 commits into from
Nov 7, 2023
Merged

Conversation

vadz
Copy link
Contributor

@vadz vadz commented Nov 5, 2023

The import commit (which needs to be backported to 3.2) here is the first one, the next ones are just refactorings trying to make the re-occurrence of such bugs less likely.

Fix using outdated click position in wxAuiTabCtrl mouse handlers, which
resulted in an invalid wxEVT_AUINOTEBOOK_DRAG_MOTION event being
generated and a crash while handling it.

Ensure that we reset m_clickPt when resetting m_isDragging too so that
we don't decide that we're dragging if the mouse enters the window with
the left button already pressed after a previous drag.

Closes wxWidgets#24027.
Passing an invalid index to this function results in a crash, so ensure
this doesn't happen -- at the very least this would have turned the
crash fixed by the parent commit into "just" an assert failure.
Ensure that all of them are initialized, including m_clickTab, which
didn't seem to be always initialized before.

No real changes (as m_clickTab doesn't seem to have been used before it
was initialized).
No real changes, just refactor the code to reset all drag-related
variables in a single function instead of doing it manually in several
places.

As this function also resets m_clickTab, which could previosuly remain a
dangling pointer, change the code to get its value before calling it.
@vadz vadz merged commit 6fbb504 into wxWidgets:master Nov 7, 2023
38 checks passed
@vadz vadz deleted the auibook-drag-fix branch November 7, 2023 14:12
vadz added a commit that referenced this pull request Nov 7, 2023
Fix using outdated click position in wxAuiTabCtrl mouse handlers, which
resulted in an invalid wxEVT_AUINOTEBOOK_DRAG_MOTION event being
generated and a crash while handling it.

Ensure that we reset m_clickPt when resetting m_isDragging too so that
we don't decide that we're dragging if the mouse enters the window with
the left button already pressed after a previous drag.

See #24027, #24039.

(cherry picked from commit f1a3816)
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.

None yet

1 participant