mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-30 06:12:12 +00:00
fix: plugin bugs (#14855)
# Description Fixes some bugs reported by users and the community # Fix 1: Latest Version If the user updates the plugin version on OrcaCloud without a changelog, the latest version shown on OrcaSlicer won't be accurate. ## Issue OrcaSlicer uses the changelog returned by OrcaCloud backend as the source of truth, even though we query a latest version from the backend as well. The changelog only consists of version entries that have changelogs so if the latest one, e.g. 1.2.0 has no changelog, but 1.1.0 has, the latest version will be interpreted as 1.1.0. ## Fix Don't use the changelog for version tracking, just use it for the plugins dialog changelog tab. # Fix 2: Host theme script / window.orca bridge leaks into cross-origin child iframes If a plugin's embedded app renders its own `<iframe>` (its real catalog/dashboard UI, or a third-party auth/payment widget), that child document also gets, uninvited: the host theme `<style>` block fighting whatever CSS the child page already defines. ## Issue OrcaSlicer injects host themed scripts and window.orca bridge into every page, potentially breaking any cross origin child frames or `<iframes>` in general. ## Fix Only inject top level frames by checking `if (window.top !== window.self) return;`. # Fix 3: Transferring Slicing Pipeline Plugin config when switching printers (#14832) Select an entry in the Process tab's "Slicing Pipeline Plugin" picker, switch the active printer preset, then click **Transfer** in the "modified settings" dialog — OrcaSlicer crashes immediately and repeatably. Changing other settings (e.g. a single scalar option) does not reproduce it; only this picker does. ## Issue `slicing_pipeline_plugin` is a vector option (`coStrings`) with an empty default. `deep_diff` diffs vector options per-index, so selecting a plugin produced a `"slicing_pipeline_plugin#0"` dirty key instead of a plain one. Unlike genuine per-extruder options, this key wasn't caught by the printer-switch filter that discards stale per-extruder changes, so it got cached and replayed through `ConfigBase::apply_only`'s `'#'`-indexed branch, which calls `ConfigOptionVector::set_at()` on the freshly-reloaded (and still empty) destination vector. `set_at()`'s only empty-vector guard is an `assert()`, which is compiled out of Release builds, so it dereferences `values.front()` on an empty vector — undefined behavior, matching the reported ACCESS_VIOLATION. ## Fix Treat `slicing_pipeline_plugin` as a single atomic value in `deep_diff` (`Preset.cpp`), same as `printable_area`/`thumbnails`/etc., since it isn't actually per-extruder data. It's now diffed and replayed as a whole option (`ConfigOptionVector::set()`, a plain vector assignment) instead of the index-based `set_at()` path — removing the crash unconditionally, regardless of whether the two printers share the same extruder configuration. # Fix 4: Stale .whl cache After a .whl was loaded once, if at runtime, the .whl is replaced with a new one, the plugin system will use the stale .whl cache. ## Fix Added an option in the context menu to Reload or Delete Cache and Reload for locally installed plugins. The assumption here is that users shouldn't be modify cloud plugins, and if they want to develop on a subscribed cloud plugin, they should create a local copy of it. <!-- > A guide for users on how to download the artifacts from this PR. --> [How to Download Pull Requests Artifacts for Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
This commit is contained in:
@@ -52,6 +52,29 @@ print('ok')
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("plugin latest version uses the authoritative catalog field", "[PluginDescriptor]")
|
||||
{
|
||||
PluginDescriptor descriptor;
|
||||
descriptor.version = "1.3.0";
|
||||
descriptor.latest_version = "1.3.0";
|
||||
PluginChangelog changelog;
|
||||
changelog.version = "1.2.0";
|
||||
descriptor.changelog.push_back(changelog);
|
||||
|
||||
CHECK(descriptor.latest_available_version() == "1.3.0");
|
||||
}
|
||||
|
||||
TEST_CASE("plugin latest version falls back to the descriptor version", "[PluginDescriptor]")
|
||||
{
|
||||
PluginDescriptor descriptor;
|
||||
descriptor.version = "1.1.0";
|
||||
PluginChangelog changelog;
|
||||
changelog.version = "1.0.0";
|
||||
descriptor.changelog.push_back(changelog);
|
||||
|
||||
CHECK(descriptor.latest_available_version() == "1.1.0");
|
||||
}
|
||||
|
||||
// Regression: update_cloud_metadata() replaces a matched entry's descriptor wholesale with the
|
||||
// cloud catalog record (`entry = cloud_entry`). Configuration used to ride on the descriptor, so
|
||||
// that overwrite silently wiped it and plugins fell back to their built-in defaults (found via
|
||||
|
||||
Reference in New Issue
Block a user