Repository navigation
fix(mfcwx): stop deferred tab activation from using a deleted main frame - #4
Merged
Merged
Conversation
Closing an MDI child posted a call to the main frame's OnChildActivated, and the notebook's page-changed handler captured the frame pointer. When the main window closed right after (closing the app with documents open), the CMainFrame object was already deleted when those ran, which crashed in CMDIFrameWnd::OnChildActivated. Both now look the frame up by its window when they run and do nothing if it is gone. Also routes ID_APP_EXIT to CWinApp::OnAppExit as MFC's CWinApp message map does (File > Exit did nothing), and adds a close step to MFCWX_AUTOMATION.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the crash in
CMDIFrameWnd::OnChildActivated()reported from release build 10.Closing an MDI child posted a call to the main frame's
OnChildActivated, and the notebook's page-changed handler captured the frame pointer. When the main window closed right after (closing the app with documents open), theCMainFrameobject was already deleted when those ran. Both now look the frame up by its window when they run and do nothing if it is gone.Reproduced with the automation runner (open Caesar result, close a tab, close the main window): before 3/3 runs crashed with SIGSEGV, after 3/3 exit cleanly. The full sweep of 191 menu commands still passes and all 13 unit tests pass.
Also:
ID_APP_EXITis now routed toCWinApp::OnAppExit, as in MFC'sCWinAppmessage map.MFCWX_AUTOMATIONgains aclosestep (WM_CLOSE to the main window).