diff options
author | Hossein <hossein@libreoffice.org> | 2022-10-10 15:48:02 +0200 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-10-10 18:27:03 +0200 |
commit | d1707bc31261d16893c1f5240c803d283e293ec1 (patch) | |
tree | 91a027b01e25e97a42f731cb144e59a7c873e114 /desktop/source | |
parent | 696d5c865c75c0a16f7367a9f9103684d764f75c (diff) |
tdf#149718 Fix crash on insert chart for tables with merged cells
Previously inserting charts for tables with merged cells lead to crash.
This was because a wrong assumption in unochart.cxx, specifically
SwChartDataProvider::Impl_createDataSource() that every row has the same
number of columns. Therefore the code was using the number of columns in
the first row as the number of columns for all the rows, which is wrong.
For example, inserting a chart for the second column of this table leads
to a crash:
[ ]
[ 1 ][ 2 ]
In this way, an assertion failure was created because the number of
columns where counted from the first row, which has merged cells, and
therefore fewer number of columns compared to the last column of the
selected part.
To solve tdf#149718, now we use the maximum number of columns calculated
across all the rows. In this way, the remainder of the function does not
need a fix, although a cleanup for the whole function can be interesting
and help avoid using tiny extra memory space.
A UITest is provided to avoid this bug in the future. To run the test:
cd sw && make -srj1 UITest_sw_chart \
UITEST_TEST_NAME="tdf149718.tdf149718.test_chart_from_table_with_merged_cells" \
SAL_USE_VCLPLUGIN=gen
Change-Id: I3c1000d7f177417e98d3a8ceae7886824c1053a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140092
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'desktop/source')
0 files changed, 0 insertions, 0 deletions