[UE 5.8.3][Editor] Level viewport settings (show flags such as Grid) are lost on Cmd+Q / File > Exit; only the window close button saves them

Summary

Level viewport settings (show flags such as Grid, view mode, FOV, realtime) are not saved when the editor exits via File > Exit, or via Cmd+Q on macOS. They are saved only when the main editor window is closed with its window close button.

Viewport settings are written only by FGlobalTabmanager::SaveAllVisualState() (each viewport tab’s SetOnPersistVisualState handler: FLevelViewportTabContent::SaveConfig → SLevelViewport::SaveConfig). In 5.8 the only exit path that calls it is FMainFrameHandler::CloseRootWindowOverride (MainFrameHandler.h), i.e. the main window’s close button. File > Exit (FMainFrameActionCallbacks::Exit) and the macOS Quit command (requestQuit in LaunchMac.cpp) both queue CLOSE_SLATE_MAINFRAME, which runs FMainFrameModule::RequestCloseEditor → FMainFrameHandler::ShutDownEditor, and that never calls SaveAllVisualState.

This mostly hits Mac users, because Cmd+Q is the normal way to quit a Mac app. File > Exit is affected on every platform by the same code, though we only reproduced it on macOS.

Suggested fix: call FGlobalTabmanager::Get()->SaveAllVisualState() (when CanSavePersistentLayouts()) in RequestCloseEditor as well, before CanCloseEditor(), matching CloseRootWindowOverride.

What Type of Bug are you experiencing?

Editor

Steps to Reproduce

  1. Open any project and level in the editor, with the default level viewport layout.
  2. In the perspective viewport, open the Show menu and turn off Grid.
  3. Quit the editor with Cmd+Q (or File > Exit).
  4. Relaunch the editor and open the same level.

Expected Result

Grid stays off, as it does when the editor is closed with the main window’s close button.

Observed Result

Grid is back on. Every per-viewport setting saved through SLevelViewport::SaveConfig is lost the same way. EditorPerProjectUserSettings.ini is rewritten on exit, but [/Script/UnrealEd.LevelEditorViewportSettings] PerInstanceSettings still holds the previous values (here: Grid=1 in the perspective viewport’s EditorShowFlagsString).

Tested on UE 5.8.3 (CL 58210709, launcher build), macOS 26.6.2, Apple Silicon.

Affects Versions

5.8

Platform(s)

Mac