Preferences: preserve unknown WebServer Template across GUI Save (#267) - #621
Merged
mrjimenez merged 1 commit intoMay 15, 2026
Merged
Conversation
…le-project#267) Cfg_Skin::TransferToWindow populates the prefs-dialog wxChoice by scanning the *local* webserver and skin directories. When the configured value isn't found in the local listing -- e.g. when amulegui runs on a different host than amuleweb, or templates live outside the dirs the GUI scans -- FindString returns wxNOT_FOUND and the dropdown silently defaults to index 0. The subsequent TransferFromWindow at Save time reads index 0 back into m_value, overwriting amule.conf's Template=AmuleWebUI-Reloaded with an empty string. The webserver then falls back to the default template until the user re-edits the config file by hand. The two Cfg_Skin sites have different semantics: * /SkinGUIOptions/Skin renders inside amulegui itself, so a local fallback to "- default -" is the right behaviour (existing branch). Skin files genuinely can't be loaded from a remote host. * /WebServer/Template is consumed entirely by amuleweb, which may well be on a different filesystem from amulegui. The GUI has no business overwriting a value it doesn't recognise. For the template case, append the unrecognised non-empty value to the dropdown and select it, so TransferFromWindow reads back the same string and the save round-trip becomes idempotent. Skin behaviour is unchanged. Verified on macOS arm64: monolithic amule rebuilds clean. Reported by ngosang.
mrjimenez
pushed a commit
to mrjimenez/amule
that referenced
this pull request
Jul 27, 2026
amule-project#621) Downloading a large multi-selection of search results into a big queue froze the monolithic GUI, the same way amule-project#615 did over the remote GUI -- just on a different, un-batched path. CSearchListCtrl::DownloadSelected() loops over the selection calling Search_Add_Download per file. In the monolithic build that notification runs synchronously on the main thread, so each file's AddFile() fires a per-item SortList() inline -- a full re-sort of the whole download list on every insert, O(n^2) on a large queue. Wrap the selection loop in the download list's BeginBatchUpdate() / EndBatchUpdate() so the burst collapses into a single sort + repaint, mirroring the remote GUI's poll path (amule-project#620). Monolithic-only: the remote GUI's adds arrive later via the download-queue poll, which already batches, so the code is gated behind #ifndef CLIENT_GUI.
mrjimenez
pushed a commit
to mrjimenez/amule
that referenced
this pull request
Jul 27, 2026
…reconnect (amule-project#622) Companion to amule-project#620/amule-project#621. Adding a burst of freshly-shared files over the remote GUI -- many downloads completing daemon-side, or a shared folder added/rescanned on the daemon -- froze the GUI on a large share. amule-project#620 fixed the equivalent download-list case but deliberately left the shared-files ctrl batched reconnect-only. CKnownFilesRem::ProcessUpdate() adds each new shared file via CSharedFilesCtrl::ShowFile() -> AddItemData(), which on this virtual list does a sorted insert AND rebuilds the entire row index (RebuildRowIndex) on every call -- O(n) per insert, O(n^2) for a burst on an n-file share. Unlike the download list, a plain Freeze/deferred-sort batch wouldn't help, because the per-insert cost is the row-index rebuild, not a sort. Give the shared-files ctrl the same append-path batching the download list already uses: during a batch, ShowFile() appends with AppendItemDataNow() (O(1), and it keeps the row index and item count live so the interleaved reconcile prune and in-place UpdateItem() stay correct), and the single SortList() is deferred to EndBatchUpdate(doSort). The non-batch single-add path is unchanged. ProcessUpdate() now batches the shared list on every non-initial poll and sorts once at the end only if the poll added a file (sharedListGrew). Monolithic is unaffected: its bulk shared paths funnel through the batched Reload() -> ShowFileList(), and the dir-watcher coalesces bursts into a single Reload(). Verified by building amule and amulegui.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Editing any preference in amulegui and clicking Save silently clears
Template=AmuleWebUI-Reloaded(or any other template name) fromamule.conf, falling back the web UI to the default skin until the user re-edits the config by hand. ngosang isolated the symptom in #267.Root cause
Cfg_Skin::TransferToWindowpopulates the prefs-dialog wxChoice by scanning the local webserver / skin directories on the machine running amulegui. When the configured value isn't found in the local listing:FindStringreturnswxNOT_FOUND, the dropdown silently selects index 0 (typically empty or "no options available"), and the subsequentTransferFromWindowat Save time reads that back intom_value. The "value resets to whatever the widget shows" pattern erases the on-disk Template.This bites users whose:
/usr/local/share/...while the GUI scans the user's~/.aMule/webserver/)Fix
The two
Cfg_Skinsites have different semantics:/SkinGUIOptions/Skinrenders inside amulegui itself — a local fallback to "- default -" is correct, the GUI genuinely can't load a skin file it doesn't have./WebServer/Templateis consumed entirely by amuleweb, which may be on a different filesystem from amulegui. The GUI has no business overwriting a value it doesn't recognise.For the template case, append the unrecognised non-empty value to the dropdown and select it, so
TransferFromWindowreads back the same string and Save becomes a no-op:Skin behaviour is unchanged. Template values that genuinely are present locally still match via
FindStringand follow the existing path.Validation
amulerebuilds clean.Template=AmuleWebUI-Reloadedinamule.conf, open GUI prefs, change any other value, Save) no longer rewritesTemplateto empty — the value round-trips through the dropdown intact.Closes #267.