summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrenttask.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2025-09-05 10:34:08 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2025-09-08 11:25:02 +0200
commit68a5ec23f683c7778f587842fe35a47b545cf9d1 (patch)
tree82f0538aa653234332395f3fc1e8cabcfce42960 /src/concurrent/qtconcurrenttask.h
parentf14552296ab8652bd9305fececb47654f5bd0a18 (diff)
Fix possible assert when inserting columns in QTextDocument
In certain tables which have cells that contain row spans in beginning of a row, we could get into an inconsistent state which would leave cells in the table unmapped/invalid. Specifically, this happened when inserting a new left-most column. The algorithm has two data structures: A "logical cells map" which gives the row span and col span of each cell, and then a grid which maps the logical index of each (x,y) to a cell. What happened in this case was that we were inserting at pos == 0. For each row, we would then search for an insertion point in that row by looking at the grid and finding the logical index of the first slot in this particular row of the grid. Then we would insert a new cell directly before this index in cells and continue. If we find a logical index which actually belongs to a prior row than the one we are inserting into, since a previous cell has a row span, we need to continue searching. Otherwise we end up inserting the new column into this previous row, which we have already handled. This is where it went wrong: There was logic to handle this by checking the logical index we found against the logical index of the last grid slot in the previous row, and it is even documented in a comment. But when pos==0, then we would *always* set "logicalGridPositionBeforePosition" to -1, thus we would never actually apply this condition for pos==0. Setting logicalGridPositionBeforePosition to -1 is correct for the first row, since there is no previous grid slot to look at, but for subsequent rows we can still do this look up even for pos == 0. Pick-to: 6.5 6.8 6.9 6.10 Fixes: QTBUG-138678 Change-Id: I6094e7d0f41611b6d8b0952eac876bf2e41dfe9c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrenttask.h')
0 files changed, 0 insertions, 0 deletions