fix(viewcube): cache UCS picker names behind an epoch

The two per-frame ViewCube blocks rebuilt the named-UCS name list (N String clones plus a Vec) every frame; now Scene::cached_ucs_names memoises it behind ucs_epoch and the picker takes the Arc, so frames cost a refcount bump. Bumped on UCS SAVE, UCS DELETE, RENAME UCS, record-API ucss patch, file-open, and undo Full-swap. Tests: cached_ucs_names_returns_same_arc_until_bump pins the hit path; cached_ucs_names_invalidated_by_bump pins rebuild with new content. Full suite: 1976 passed / 0 failed / 25 ignored.
This commit is contained in:
Karim Jerbi committed 2026-10-06 20:10:23 +01:00
1 parent bd37a2f969
commit 8c2cfa2c8f
9 files changed
+85 -20

No files matched your search

+6 -16
View File
@@ -1416,14 +1416,9 @@ bg={bg_ms:.1}ms n={view_count}"
.as_ref()
.map(|u| u.name.clone())
.unwrap_or_default();
let ucs_names: Vec<String> = tab
.scene
.document
.ucss
.iter()
.map(|u| u.name.clone())
.filter(|n| !n.is_empty())
.collect();
// Epoch-memoised (#34): Arc clone per frame, rebuilt only
// after a UCS-table bump.
let ucs_names = tab.scene.cached_ucs_names();
let picker = iced::widget::pin(iced::widget::opaque(viewcube_ucs_picker(
ucs_current,
ucs_names,
@@ -1456,14 +1451,9 @@ bg={bg_ms:.1}ms n={view_count}"
.as_ref()
.map(|u| u.name.clone())
.unwrap_or_default();
let ucs_names: Vec<String> = tab
.scene
.document
.ucss
.iter()
.map(|u| u.name.clone())
.filter(|n| !n.is_empty())
.collect();
// Epoch-memoised (#34): Arc clone per frame, rebuilt only
// after a UCS-table bump.
let ucs_names = tab.scene.cached_ucs_names();
let picker = iced::widget::pin(iced::widget::opaque(viewcube_ucs_picker(
ucs_current,
ucs_names,