fix: isolate calibration temp paths per user (#14619)

* fix: isolate calibration temp paths per user

The calibration temp files under <temp>/calib were file-scope statics
initialized before set_temporary_dir() runs at startup, so they kept
using the shared system temp root and missed the per-user isolation
added in #14607. On Linux every account shares /tmp, so the first user
to calibrate owns /tmp/calib and later users fail to write there, the
same cross-user collision #14607 fixed for model backups, STEP import,
and part skip.

Build the paths lazily from temporary_dir() instead, through a
calib_temp_dir() accessor and a calib_temp_file() join helper. The base
becomes <temp>/orcaslicer_<uid>/calib on Linux and is unchanged on
Windows, where the temp dir is already per user.

Also make StoreParams::path a std::string rather than a non-owning
const char*. The calibration code had to keep a std::string alive
solely to feed that pointer, and the field was uninitialized by
default; owning the string removes the lifetime hazard for all three
callers and makes the entry guard a reliable empty() check. Confined to
the 3mf project exporter (three callers, two internal reads); no
on-disk, format, or ABI impact.

Follows up on #14607 per @Noisyfox's review suggestion.
This commit is contained in:
Kris Austin
2026-07-08 08:14:05 -05:00
committed by GitHub
parent b37fa41742
commit b58025575d
5 changed files with 29 additions and 20 deletions

View File

@@ -15742,7 +15742,7 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
std::vector<Preset*> project_presets = preset_bundle.get_current_project_embedded_presets();
StoreParams store_params;
store_params.path = path_u8.c_str();
store_params.path = path_u8;
store_params.model = &p->model;
store_params.plate_data_list = plate_data_list;
store_params.export_plate_idx = export_plate_idx;