Bug 78699 - crash after Undo of Sort with cell comment and then re-sort
Summary: crash after Undo of Sort with cell comment and then re-sort
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium major
Assignee: Not Assigned
Whiteboard: BSA
Keywords: haveBacktrace
Depends on:
Reported: 2014-05-14 14:56 UTC by gtrelat
Modified: 2014-09-16 23:47 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

gdb log file (2.31 KB, text/plain)
2014-06-10 09:06 UTC, gtrelat
bt console (9.83 KB, text/plain)
2014-06-21 07:51 UTC, Julien Nabet
To reproduce bugs (36.65 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-09-01 12:34 UTC, gtrelat

Note You need to log in before you can comment on or make changes to this bug.
Description gtrelat 2014-05-14 14:56:24 UTC
Problem description: 

Calc crash when auto filter enabled and empty column header and try to sort table.

Steps to reproduce:
1. add column with empty header but with a non-empty cell
2. enable auto filter
3. try to sort table

Current behavior:
calc crash (maybe segmentation fault)

Expected behavior:
calc not crash but it could warning the user about header problem.

Operating System: Windows 7
Version: release
Comment 1 Julien Nabet 2014-05-18 20:17:57 UTC
For the test, could you give a try to dev version? (see http://dev-builds.libreoffice.org/daily/libreoffice-4-2/Win-x86@42/current/)
It could be a dup of fdo#78079 (put in See Also)
Comment 2 gtrelat 2014-05-20 07:30:41 UTC
I tried the dev build, but the crash remain. I give you the step to reproduce bug:

- enter "header" in A1
- enter "Data" in A2 and B2
- enter a comment in A2
- leave B1 empty
- go to A2
- click on button sort ascending
- we can see that header are sorted with others data -> so wrong
- i undo the the sort
- i retry to sort acscending


i have tested this with :

Crash with :

- Windows XP 4.16, 4.25 (libo-42~2014-05-18_18.05.37_LibreOfficeDev_4.
- Windows Seven 4.16
- Linux 4.14, 4.20, 4.22

No crash with Debian wheezy LO 3.5.4

I try to define you the bug :

When a table include an empty header, the sort not work properly (datas and header are sorted, i think header must stay in place : 1st line )

LO crash only when a comment is inserted on a cell, try to sort, undo the sort, retry the sort.
Comment 3 Julien Nabet 2014-05-28 19:51:55 UTC
On pc Debian x86-64 with master sources updated yesterday, I could reproduce the crash once.
I meant, I tested by launching LO from console and reproduced the crash.
Then I gave a try with gdb to retrieve a backtrace, no crash.
Then I gave a new try from console only, no crash! :-(

Put it back to UNCONFIRMED.
Comment 4 Joel Madero 2014-06-04 04:26:44 UTC

Ubuntu 14.04 x64

New (confirmed)
Major (crasher but only after a specific set of steps that might not be reproduced often)

Going to try to bibisect now
Comment 5 Joel Madero 2014-06-04 04:38:31 UTC
So ridiculous - confirmed it the first time, now I can't for the life of me.

@gtrelat - any way that you can get a backtrace for us? Is it consistently crashing for you?

Comment 6 gtrelat 2014-06-10 09:06:18 UTC
Created attachment 100792 [details]
gdb log file
Comment 7 Julien Nabet 2014-06-21 07:51:55 UTC
Created attachment 101470 [details]
bt console

On pc Debian x86-64 with master sources updated yesterday, I could reproduce the crash, even in gdb.
I attached console logs and bt.
Comment 8 Julien Nabet 2014-06-21 07:52:35 UTC
Kohei/Markus/Eike: one for you?
Comment 9 Eike Rathke 2014-07-18 17:52:49 UTC
So this is completely unrelated to auto-filter, but somehow to Undo of Sort with cell comment and then re-sort instead (which also the bt suggests). Updating summary for this.

Could reproduce in 4-2-6 following steps in comment 2, but no crash in 4-3-0 or master.
Comment 10 Kohei Yoshida 2014-08-26 13:38:32 UTC
FYI the sort undo redo code is totally different now on master, 4.3 and the latest 4.2 branch (although the one in the 4.2 branch was not my intent).  This needs to be re-tested with the new code.
Comment 11 gtrelat 2014-09-01 12:34:55 UTC
Created attachment 105557 [details]
To reproduce bugs
Comment 12 gtrelat 2014-09-01 12:36:41 UTC
Comment on attachment 105557 [details]
To reproduce bugs

Hi, we do some check with the latest code :

4.2.6-secfix -> crash (seg fault) -> no crash

Thanks for the fix in 4.3 branch. 

But, it remain our principal problem : one or more empty cell in the row header. When sorting or filtering, the row header is not recognize as expected. 

This cause strange behaviors for the sort and the auto-filter functionality.

I attach a calc file to reproduce bugs.

example for the sort : (steps to reproduce)

1) select a cell
2) do a sort (Ascendant or Descending)
--> header row not recognized, so the row is sorted with others data

example for the filter : (steps to reproduce)

1) select a cell
2) do a auto-filter
--> a popup dialog appears which ask if we want to use the first row as header.
--> answer "Yes" or "No" have the same effects
Comment 13 Eike Rathke 2014-09-16 23:47:03 UTC
Can't reproduce crash anymore in current 4-2 (to be 4.2.7)