Bug 168478 - Edit under filter and then reset the filter, Calc crashed
Summary: Edit under filter and then reset the filter, Calc crashed
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.8.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:26.2.0 target:25.8.3 target:25...
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-09-19 14:05 UTC by Franklin Weng
Modified: 2025-09-29 14:55 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (28.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-09-19 23:06 UTC, Franklin Weng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Franklin Weng 2025-09-19 14:05:46 UTC
Description:
In Calc, filter the data with Data -> More Filter -> Standard Filter, and then edit in another column, then reset the filter, Calc crashed.

The feature is good in 25.2.

Steps to Reproduce:
1. Open the example ods file.
2. Select Column B, use Data -> More Filter -> Standard Filter
3. Field name: Column B, Condition: Contains, Value: 1-A
4. Column B shows only 10 rows of "Search Pattern 1-A"
5. Put a "v" in Column D in every row
6. Select Column B, Data -> More Filter -> Reset Filter

Actual Results:
Calc crashed.

Expected Results:
It should reset the filter and show all the data, with some rows having "v" in Column D.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.8.0.2 (X86_64)
Build ID: 80a8bc2ef75d415a197e282da0ebf917315d5e24
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: zh-TW (zh_TW.UTF-8); UI: en-US
Calc: threaded

It's good in 25.2.
Comment 1 m_a_riosv 2025-09-19 21:39:15 UTC
The sample file?
Comment 2 Franklin Weng 2025-09-19 23:06:42 UTC
Created attachment 202910 [details]
Sample file
Comment 3 Franklin Weng 2025-09-19 23:53:19 UTC
Result of bibisect:
 67ca54a4e0b47130b837d74a77f7c0b397c476fa is the first bad commit
commit 67ca54a4e0b47130b837d74a77f7c0b397c476fa
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Thu Jun 19 22:32:27 2025 +0200

    source bd90bfb91c2378f2e0aca502c44b5c6502da4170
    
    source bd90bfb91c2378f2e0aca502c44b5c6502da4170

 instdir/program/libsclo.so | Bin 26929848 -> 26929848 bytes
 instdir/program/setuprc    |   2 +-
 instdir/program/versionrc  |   2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)


Source commit log:
commit bd90bfb91c2378f2e0aca502c44b5c6502da4170
Author: Andreas Heinisch <andreas.heinisch@yahoo.de>
Date:   Wed Jun 18 22:38:19 2025 +0200

    tdf#117346 - Show current data range of the filter without selection
    
    After resetting the filter, show current data range of the filter with
    selection. This reset also the filter button.
    
    Change-Id: I3885e3d21ce3849abe4786621d0fc391b29f8b71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186695
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
    (cherry picked from commit 06135b1102d28ae1c2d95e52504e824a9847bf12)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186722
    Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Comment 4 raal 2025-09-20 12:41:49 UTC
No crash in Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8ea8e254a3151f5390f3a10ff156fcaf8e7c5d5c
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8ea8e254a3151f5390f3a10ff156fcaf8e7c5d5c
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

but filter doesn't reset.
Comment 5 raal 2025-09-20 12:57:28 UTC
The crash was fixed with this commit

linux-64-26.2 c73836b58f017be6d19cba3ecff73cf5411ca9ee is the first bad commit
commit c73836b58f017be6d19cba3ecff73cf5411ca9ee
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Thu Aug 14 17:43:28 2025 +0200

    source 2f050e29afc3d44c4fe348e0ac2f43bd2261cb4f

189585: crashreporting: sc: check GetDBData() | https://gerrit.libreoffice.org/c/core/+/189585

but the problem with reset filter was introduced..

CC to Xisco
Comment 6 Andreas Heinisch 2025-09-20 15:17:16 UTC
Tested in:
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f5a021194a3dd0fed864f6fa94594e3bfdc1e8d1
CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-GB (de_DE); UI: en-US
Calc: CL threaded

If the entire column B will be selected, the filter reset does not work. However, if just a single cell in the column B will be selected the filter resets.
Comment 7 Andreas Heinisch 2025-09-20 16:16:34 UTC
Investigated the error and it seems that the patch causing this problem only made the problem more evident. In ScDBData* ScDocShell::GetDBData [1] the filtered range will be retrieved. If there is just a single selection, the filtered are will be expanded to the area of the auto filter. Imho, there is still a problem there being the root cause of bug 117328. The range will be extended to the selected are in [2] but the new area could be smaller than the actual filtered area.

So, if you don't select the exact filtered area of the filtered range, a new filtered range will be created just for the purpose of resetting it in [3]. The same implementation error causes bug 117346.

My patch just tried to not create new filtered database areas if we where resetting a filtered range. Don't know how to resolve it and if this problem is a bug or a feature when creating standard filters.


[1] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docsh5.cxx?r=6376fe01859a14a22b2601ff04691ceb894c33d4#112
[2] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docsh5.cxx?r=6376fe01859a14a22b2601ff04691ceb894c33d4#172
[3] https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docsh5.cxx?r=6376fe01859a14a22b2601ff04691ceb894c33d4#234
Comment 8 Andreas Heinisch 2025-09-20 16:48:57 UTC
Tests are welcome: https://gerrit.libreoffice.org/c/core/+/191245
Comment 9 Commit Notification 2025-09-23 20:02:42 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6f68c46d0aa5fe872de0dec8777d35ff91886043

tdf#168478 - Use the previously found range rather than returning an empty one

It will be available in 26.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2025-09-24 08:16:52 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/79b1860c23ead30dd230768012db72075f4c11f5

tdf#168478 - Use the previously found range rather than returning an empty one

It will be available in 25.8.3.

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

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2025-09-24 15:25:53 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3e8a15d37d11ee05cb70a1a52e7070cdd887848a

tdf#168520 - Rename tdf168478 to tdf168478_restore_multiple_cell_selection

It will be available in 26.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2025-09-29 14:55:18 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-25-8-2":

https://git.libreoffice.org/core/commit/a4d111994bda82d9156dfe7d8d78db96b2f174da

tdf#168478 - Use the previously found range rather than returning an empty one

It will be available in 25.8.2.

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

Affected users are encouraged to test the fix and report feedback.