GNOME Bugzilla – Bug 674914
Validation should use managed dependents
Last modified: 2012-05-10 19:59:56 UTC
Right now we store 0-2 expressions in a validation. We should store them in managed deps so they respect insert/row insert/delete and other similar operations.
This is true for conditional formatting too. At least at the moment we don't respect insert/row insert/delete.
Right, but the issues are slightly different, so that is now bug 674954.
Just using a GnmDependent is not enough: GnmValidation is used in GnmStyle. It is part of the hash[1], so if we were to magically change the expression, we would change the hash value. That would corrupt hash tables. In practice that means sheet->style_data->style_hash. We will have to remove the style from there before changing it and re-insert it afterwards. And deal with the possibility that it clashes with another entry after the change. Undo will then not be a simple matter of restoring the expression in the dependent. Is it even correct to change all cells with the same validation to the same thing in response to col/row insert/delete? Luckily we can assume that styles are not shared across sheets. That still leaves issues with relative addressing. In short, it's a bit of a mess. [1] Well, the pointer value of the GnmValidation is part of the hash, but since nothing keeps validations unique by pointer that is a bug in and of itself.
Note, that the hash parts of this are easy to fix: just don't have the validation be part of the hash. There, done. But that does nothing for the harder issue of style collision after the change.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.