Skip to content

fix(amulegui): persist list-control settings on every macOS quit path - #290

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/amulegui-persist-listctrl
Jul 4, 2026
Merged

fix(amulegui): persist list-control settings on every macOS quit path#290
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/amulegui-persist-listctrl

Conversation

@got3nks

@got3nks got3nks commented Jul 4, 2026

Copy link
Copy Markdown

Problem

On macOS, resizing the peers-table (or any list-control) columns in amulegui only persisted when quitting with Cmd+Q. Exiting with the red X → confirm dialog, or Dock right-click → Quit → confirm, silently discarded the changes.

CMuleListCtrl::SaveSettings runs from the frame's destructor, which CamuleDlg::OnClose → CamuleRemoteGuiApp::ShutDown only schedules (amuledlg->Destroy() is lazy). CamuleRemoteGuiApp::OnExit then std::_Exit(0)s to dodge the wxWebSession dtor crash (#18 / #159), which skips wx's own cleanup — so the queued destroy and the wxConfig flush never run and the freshly-written column widths / sort orders are lost. Cmd+Q happened to drain the pending-delete queue naturally, which is why only that path persisted.

Fix

Mirrors the monolithic app in two places:

  • OnExitDeletePendingObjects() + tear down wxConfig (which flushes it) before _Exit(0), so the red-X + confirm path runs the list-control destructors against a live config. Same idea as CamuleApp::OnExit (fix(macos): persist list-control settings on Dock → Quit #141).
  • OnQueryEndSession / OnEndSession handlers — the Dock right-click → Quit path ends the session without going through OnExit, so route it through ShutDown + OnExit explicitly. Mirrors CamuleGuiApp (amule-gui.cpp).

Testing

macOS, resized the Transfers/peers columns and verified persistence across relaunch on all three quit paths: Cmd+Q, red X → confirm, and Dock → Quit → confirm. All three now save.

CMuleListCtrl::SaveSettings runs from the frame's destructor, which
CamuleDlg::OnClose -> CamuleRemoteGuiApp::ShutDown only schedules
(amuledlg->Destroy(), lazy). CamuleRemoteGuiApp::OnExit then std::_Exit(0)s
to dodge the wxWebSession dtor crash, which skips wx's own cleanup, so the
queued destroy and the wxConfig flush never happen and freshly-resized column
widths / sort orders are silently lost. Cmd+Q happened to drain the queue
naturally, which is why only that path persisted.

Two fixes, mirroring the monolithic app:

- OnExit: DeletePendingObjects() + tear down wxConfig (which flushes it)
  before _Exit(0), so the red-X + confirm path runs the list-control
  destructors against a live config. Mirrors CamuleApp::OnExit (amule-project#141).

- OnQueryEndSession / OnEndSession handlers: the macOS Dock right-click ->
  Quit path ends the session without going through OnExit, so route it through
  ShutDown + OnExit explicitly. Mirrors CamuleGuiApp (amule-gui.cpp).
@got3nks
got3nks force-pushed the fix/amulegui-persist-listctrl branch from 4b22954 to 0608697 Compare July 4, 2026 10:00
@got3nks
got3nks merged commit 3a49c18 into amule-org:master Jul 4, 2026
12 checks passed
@got3nks
got3nks deleted the fix/amulegui-persist-listctrl branch July 4, 2026 10:23
Cflsft pushed a commit to Cflsft/amule that referenced this pull request Jul 6, 2026
…amule-org#290)

CMuleListCtrl::SaveSettings runs from the frame's destructor, which
CamuleDlg::OnClose -> CamuleRemoteGuiApp::ShutDown only schedules
(amuledlg->Destroy(), lazy). CamuleRemoteGuiApp::OnExit then std::_Exit(0)s
to dodge the wxWebSession dtor crash, which skips wx's own cleanup, so the
queued destroy and the wxConfig flush never happen and freshly-resized column
widths / sort orders are silently lost. Cmd+Q happened to drain the queue
naturally, which is why only that path persisted.

Two fixes, mirroring the monolithic app:

- OnExit: DeletePendingObjects() + tear down wxConfig (which flushes it)
  before _Exit(0), so the red-X + confirm path runs the list-control
  destructors against a live config. Mirrors CamuleApp::OnExit (amule-org#141).

- OnQueryEndSession / OnEndSession handlers: the macOS Dock right-click ->
  Quit path ends the session without going through OnExit, so route it through
  ShutDown + OnExit explicitly. Mirrors CamuleGuiApp (amule-gui.cpp).
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.

1 participant