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 starting program with pattern editor off-screen #129

Conversation

nyanpasu64
Copy link
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
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
1 participant