Skip to content

Fix crash when starting program with pattern editor off-screen#129

Merged
nyanpasu64 merged 1 commit intoDn-Programming-Core-Management:masterfrom
nyanpasu64:fix-offscreen-crash
Apr 26, 2022
Merged

Fix crash when starting program with pattern editor off-screen#129
nyanpasu64 merged 1 commit intoDn-Programming-Core-Management:masterfrom
nyanpasu64:fix-offscreen-crash

Conversation

@nyanpasu64
Copy link
Copy Markdown
Collaborator

@nyanpasu64 nyanpasu64 commented Apr 19, 2022

If FamiTracker is closed when (on Windows 10) offscreen or (on Windows 7) too small, and the pattern editor is not visible the next time you launch it, CFamiTrackerView::OnEraseBkgnd() fails to call CPatternEditor::CreateBackground(). This calls CPatternEditor::CreateBackground() from CPatternEditor::DrawScreen() if CPatternEditor's pDC pointers are null.

Calling CPatternEditor::CreateBackground() is necessary both to initialize the various pDCs for CPatternEditor::DrawScreen(), and because it calls CPatternEditor::CalculatePatternLayout(), which is needed for the frame editor to scroll with playback.

This is a hack, but it seems to work and I don't know any better ways to fix it (and I don't fully understand the legacy MFC architecture).

Fixes #128.

@nyanpasu64 nyanpasu64 force-pushed the fix-offscreen-crash branch from b677798 to 741b512 Compare April 22, 2022 04:00
@nyanpasu64 nyanpasu64 merged commit 801c894 into Dn-Programming-Core-Management:master Apr 26, 2022
@nyanpasu64 nyanpasu64 deleted the fix-offscreen-crash branch April 26, 2022 04:21
@Gumball2415
Copy link
Copy Markdown
Collaborator

this PR fixes nyanpasu64/j0CC-FamiTracker#149.

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.

Crash on offscreen pattern editor or computer slowdown

2 participants