Skip to content

DOS: skip desktop mode restoration to fix crash when exiting on pure VGA#15984

Open
palxex wants to merge 1 commit into
libsdl-org:mainfrom
palxex:pr_fix_vga_crash
Open

DOS: skip desktop mode restoration to fix crash when exiting on pure VGA#15984
palxex wants to merge 1 commit into
libsdl-org:mainfrom
palxex:pr_fix_vga_crash

Conversation

@palxex

@palxex palxex commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

This PR fixes a crash on DOS platforms when destroying a window on pure VGA hardware (e.g., IBM ISA VGA in 86box) that occurs 100%.

Testing Env: 86box with IBM ISA VGA, CWSDPMI r7, DJGPP v2.05, GCC 12.2.0.

Crash stack trace( SDL part only, symbolized):

i586-pc-msdosdjgpp-addr2line function
SDL/src/video/dos/SDL_dosmodes.c:497 DOSVESA_SetDisplayMode
SDL/src/video/SDL_video.c:1553 SDL_SetDisplayModeForDisplay
SDL/src/video/SDL_video.c:2098 SDL_UpdateFullscreenMode
SDL/src/video/SDL_video.c:4544 SDL_DestroyWindow

During SDL_DestroyWindow, SDL_UpdateFullscreenMode is called with SDL_FULLSCREEN_OP_LEAVE. Inside it, there is a SDL_SetDisplayModeForDisplay(display, NULL) call explicitly commented as "Restore the desktop mode". On DOS, this operation is unnecessary during window destruction, and can cause a crash on pure VGA hardware. The actual return to text mode is already handled later in DOSVESA_VideoQuit.
This fix resolves the crash on pure VGA hardware and has been verified to cause no regression on VESA-compatible hardware.

Comment thread src/video/SDL_video.c
@slouken slouken added this to the 3.6.0 milestone Jul 13, 2026
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