Bug 116003 - Crash when asking subtotals on 2 groups with pre-sort area checked
Summary: Crash when asking subtotals on 2 groups with pre-sort area checked
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.0.0.alpha0+
Hardware: All All
: highest critical
Assignee: Eike Rathke
URL:
Whiteboard: target:6.1.0 target:6.0.4
Keywords: bibisected, haveBacktrace, needsUXEval, regression
Depends on:
Blocks:
 
Reported: 2018-02-25 10:45 UTC by raal
Modified: 2018-04-18 15:24 UTC (History)
5 users (show)

See Also:
Crash report or crash signature: ["ScTable::DoSubTotals(ScSubTotalParam &)"]


Attachments
gdb backtrace (25.59 KB, text/plain)
2018-02-25 12:53 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description raal 2018-02-25 10:45:47 UTC
Description:
bug 76795 occurs again. Tested Linux and Windows, 6.1 master

Steps to Reproduce:
Open file http://bugs.documentfoundation.org/attachment.cgi?id=96617
 - "Data" -> "Subtotals"
1st Group : Group by "Planning" (no sums at this point)
2nd Group : Group by "Lot", and calculate subtotals for "Budget"
On the Options, the "Pre-sort area" is checked.

Hitting "OK" then makes LibreOffice crash.

Actual Results:  
crash

Expected Results:
no crash


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Comment 1 Xisco Faulí 2018-02-25 12:50:23 UTC
Reproduced in

Version: 6.1.0.0.alpha0+
Build ID: ddbb78caa78085673b07dbea6f53288ec6237764
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

but not in

Version: 6.0.0.0.alpha0+
Build ID: 65ea925d173db0f319a8ca78855587d089e5270d
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

which is the commit before

author	Jean-Sebastien Bevilacqua <jsbevilacqua@linagora.com>	2017-09-07 11:15:21 +0200
committer	Eike Rathke <erack@redhat.com>	2017-09-13 19:03:10 +0200
commit	e8d370e84af5dc9b8817cbf5aa66e50db150a0c6 (patch)
tree	ce0b15bc72893674f082c047cdff78a25a767532
parent	65ea925d173db0f319a8ca78855587d089e5270d (diff)
tdf#107267: Fix grand total calculation
To fix the grand total calculation, we add another step.
This step loop through all row to find the min and max of each value.
These min and max are then used by the grand total.


@Jean-Sebastien Bevilacqua, @Ahmed GHANMI, is it related to e8d370e84af5dc9b8817cbf5aa66e50db150a0c6? Could you please take a look ?
Comment 2 Xisco Faulí 2018-02-25 12:53:55 UTC
Created attachment 140130 [details]
gdb backtrace
Comment 3 Julien Nabet 2018-03-01 22:27:55 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

Here are some gdb traces:
(gdb) frame 0
#0  0x00007fffc78c11ec in ScTable::DoSubTotals (this=0x555557a1bf50, rParam=...) at /home/julien/lo/libreoffice/sc/source/core/data/table3.cxx:2215
2215	                label += ScGlobal::GetRscString(lcl_GetSubTotalStrId(eResFunc[0]));
(gdb) p rParam
$1 = (ScSubTotalParam &) @0x7fffffff1320: {nCol1 = 0, nRow1 = 0, nCol2 = 6, nRow2 = 35, nUserIndex = 0, bRemoveOnly = false, bReplace = true, bPagebreak = false, 
  bCaseSens = false, bDoSort = true, bAscending = true, bUserDef = false, bIncludePattern = false, bGroupActive = {true, true, false}, nField = {6, 0, 0}, nSubTotals = {0, 1, 
    0}, pSubTotals = {0x0, 0x555557b4acc0, 0x0}, pFunctions = {0x0, 0x55555cad1290, 0x0}}
(gdb) p eResFunc
$2 = (ScSubTotalFunc *) 0x0
(gdb) p rParam.pFunctions
$3 = {0x0, 0x55555cad1290, 0x0}
(gdb) p rParam.pFunctions[1]
$4 = (ScSubTotalFunc *) 0x55555cad1290
(gdb) p *rParam.pFunctions[1]
$5 = SUBTOTAL_FUNC_SUM
(gdb) p aRowEntry
$6 = {nGroupNo = 0, nSubStartRow = 1, nDestRow = 44, nFuncStart = 1, nFuncEnd = 42}
(gdb) p aRowVector
$7 = std::__debug::vector of length 9, capacity 16 = {{nGroupNo = 1, nSubStartRow = 1, nDestRow = 7, nFuncStart = 1, nFuncEnd = 6}, {nGroupNo = 1, nSubStartRow = 8, 
    nDestRow = 17, nFuncStart = 8, nFuncEnd = 16}, {nGroupNo = 1, nSubStartRow = 18, nDestRow = 21, nFuncStart = 18, nFuncEnd = 20}, {nGroupNo = 1, nSubStartRow = 22, 
    nDestRow = 25, nFuncStart = 22, nFuncEnd = 24}, {nGroupNo = 1, nSubStartRow = 26, nDestRow = 33, nFuncStart = 26, nFuncEnd = 32}, {nGroupNo = 1, nSubStartRow = 34, 
    nDestRow = 40, nFuncStart = 34, nFuncEnd = 39}, {nGroupNo = 1, nSubStartRow = 41, nDestRow = 42, nFuncStart = 41, nFuncEnd = 41}, {nGroupNo = 1, nSubStartRow = 1, 
    nDestRow = 43, nFuncStart = 1, nFuncEnd = 41}, {nGroupNo = 0, nSubStartRow = 1, nDestRow = 44, nFuncStart = 1, nFuncEnd = 42}}
(gdb) p nLevelCount
$8 = 2
Comment 4 Michael Meeks 2018-03-27 12:41:17 UTC
Any news here for the ESC ? =)
Comment 5 Jean-Sebastien Bevilacqua 2018-03-27 13:12:14 UTC
None yet...
I just asked Ahmed to work on it.
Comment 6 Eike Rathke 2018-04-11 12:09:01 UTC
Any progress on this? Or should I take over?
Comment 7 Eike Rathke 2018-04-16 12:57:54 UTC
No indication of activity => taking over.
Comment 8 Commit Notification 2018-04-16 14:06:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f50e370db8f7ae20b12e312ad89a0f9961b7ee7a

Resolves: tdf#116003 check presence of subtotal in group, tdf#107267 follow-up

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Eike Rathke 2018-04-16 14:13:00 UTC
Pending review https://gerrit.libreoffice.org/52989 for 6-0
Comment 10 Commit Notification 2018-04-17 10:19:55 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4b48a0b49de597fc9e9abb012fb31b6fedfee85b&h=libreoffice-6-0

Resolves: tdf#116003 check presence of subtotal in group, tdf#107267 follow-up

It will be available in 6.0.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Xisco Faulí 2018-04-18 15:24:24 UTC
Verified in

Version: 6.1.0.0.alpha0+
Build ID: b07e8a7e16ba69e822a309ec280d1987f90021a3
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Eike, thanks for fixing this!!