sc/source/filter/oox/workbooksettings.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 7cbc16bf6e115d2aaabe9b9b20edd66a5c597571 Author: Justin Luth <[email protected]> AuthorDate: Fri Dec 12 16:42:32 2025 -0500 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Dec 22 08:56:05 2025 +0100 tdf#165180 code fragility: assert !getScDocument().GetExtDocOptions() This patch is reflecting on my 26.8 changes made in tdf#165180 xlsx UI: round-trip as 2007 Spreadsheet, not 2010-365 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195035 I don't like the way ScExtDocOptions is designed. I tried a copy/pasta implementation (AFAICS), but how can anyone be confident that nothing else will attempt to change this while WorkbookSettings is active? The problem is that this multi-value 'thing' is not a shared pointer, but a single instance. So the way people use it is to make a copy of it, change it over time, and then overwrite the previous value. That only works if you can guarantee nothing else could possibly be adjusting that multi-value thing in parallel. I tried to design it at least a bit expandable. That's why I made an entire ScExtDocOptions (instead of just an optional moLowestEdited) and put the assignment in the DTOR - inspired by copy/pasta. My implementation is fine as proven by the asserts. But these are not 'impossible situations' documentation but rather code fragility flags. Used appropriate language... An alternative implementation was tested in an earlier version of this patch - see Gerrit patchset history. I'm not clever or confident enough to try to redesign ScExtDocOptions. -Insert sheet from file: loaded as separate document - OK -Clipboard: doesn't seem to be triggered (no surprise, clipboard would be ODS, not XLSX) -??? what else might import a file into the same ScDocument? Change-Id: I714f5534847fdce4e08a02d3aa71921bf5937475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195589 Reviewed-by: Justin Luth <[email protected]> Tested-by: Jenkins diff --git a/sc/source/filter/oox/workbooksettings.cxx b/sc/source/filter/oox/workbooksettings.cxx index 1bea1995d81f..f84c613d55a8 100644 --- a/sc/source/filter/oox/workbooksettings.cxx +++ b/sc/source/filter/oox/workbooksettings.cxx @@ -109,12 +109,12 @@ CalcSettingsModel::CalcSettingsModel() : WorkbookSettings::WorkbookSettings( const WorkbookHelper& rHelper ) : WorkbookHelper( rHelper ) { - if (getScDocument().GetExtDocOptions()) - maExtDocOptions = *getScDocument().GetExtDocOptions(); } WorkbookSettings::~WorkbookSettings() { + assert(!getScDocument().GetExtDocOptions() + && "applying maExtDocOptions needs a redesign if this is ever set earlier during import"); getScDocument().SetExtDocOptions(std::make_unique<ScExtDocOptions>(maExtDocOptions)); }
