diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-11-15 18:03:09 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-11-16 10:21:09 +0100 |
commit | 78a8e561b25d6a41e63d51bf49afb8622b278009 (patch) | |
tree | 7167140313587c93f3f679f0fa4fe04ffd8afc0d /tests/manual | |
parent | ab67a6b1264b6449a99b1e73dab37521807fd56b (diff) |
QRegularExpression: do not mark as dirty on no-op setters
Quite some code in Qt takes a copy of a QRegularExpression and then
changes something on it (e.g. the case sensitivity) based on some
other criteria:
QRegularExpression copy = orig;
if (cond)
copy.setPatternOptions(copy.patternOptions() | CaseInsensitive);
use(copy);
This pattern can be found in QAIM, QString-related classes, and so on.
The "problem" is that if the attempted modification is a no-op, we'd
still invalidate the copy object (by detaching). Even if no detaches
are involved, setting the same pattern or options on a QRE object
shouldn't require a relatively expensive pattern recompile.
In summary: don't detach/mark a QRE object as dirty if a setter didn't
actually do a modification.
Change-Id: Iae0ab4a5e443e7285a83d3d7e0f1dcfd66e8d51d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/manual')
0 files changed, 0 insertions, 0 deletions