Bug 136704 - Writer crash with AutoCorrect Apply Styles on typing when pressing Enter
Summary: Writer crash with AutoCorrect Apply Styles on typing when pressing Enter
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.5.2 release
Hardware: x86-64 (AMD64) All
: high major
Assignee: Justin L
URL:
Whiteboard: target:7.2.0 target:7.1.1 target:7.0....
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: redlinehide-regressions
  Show dependency treegraph
 
Reported: 2020-09-13 05:21 UTC by complexe
Modified: 2021-01-21 10:22 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with debug symbols (10.37 KB, text/plain)
2020-09-13 09:09 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description complexe 2020-09-13 05:21:26 UTC
Description:
While AutoCorrect is set to Apply Styles while Typing, and the last line of the file ends with a colon, pressing <Enter> after that colon will cause Writer to crash. (Assuming a Style will be applied to the line with the colon, but it always crashes if that line is the only one in the file.)

Steps to Reproduce:
1.In a new odt file (easier this way)
2.Make sure the AutoCorrect while Typing is set to "Apply Styles"
3.Type "a:" (without the quotes) on the only line of the file
4.Press <enter>


Actual Results:
Writer crashes.

Expected Results:
Some Header Style should be applied to the line of text.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.6.2 (x64)
Build ID: 0ce51a4fd21bff07a5c061082cc82c5ed232f115
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win; 
Locale: en-CA (en_CA); UI-Language: en-US
Calc: threaded

but same problem with another computer with
Version: 6.3.5.2 (x64)
(Build ID not copied here, sorry!)
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win;
Locale: fr-CA (en_CA); UI-Language en-US
Calc: CL
Comment 1 Telesto 2020-09-13 07:14:08 UTC
It does
Version: 7.1.0.0.alpha0+ (x64)
Build ID: ed4f610f4a3de12016f8308a17b6ad4f86e9d67a
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

working fine in
Version: 6.0.6.0.0+
Build ID: c30963b8b4bbbe42a24b97aafa161eff9d7ccdd4
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 2 Julien Nabet 2020-09-13 09:09:53 UTC
Created attachment 165444 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 3 Attila Baraksó (NISZ) 2020-09-16 09:57:19 UTC
Bibisected using bibisect-win32-6.3 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=eb92dc08f2abf5ed088da0d736266f213adf00de
author: Michael Stahl <Michael.Stahl@cib.de>
committer: Michael Stahl <Michael.Stahl@cib.de>
summary: sw_redlinehide_4a: SwAutoFormat iterates frames, not nodes

Adding CC: Michael Stahl
Comment 4 Justin L 2021-01-15 18:59:30 UTC
#0  std::__uniq_ptr_impl<sw::MergedPara, std::default_delete<sw::MergedPara> >::_M_ptr() const (this=0x170) at /usr/include/c++/9/bits/unique_ptr.h:154
#1  0x00007fffbd98c8e0 in std::unique_ptr<sw::MergedPara, std::default_delete<sw::MergedPara> >::get() const (this=0x170) at /usr/include/c++/9/bits/unique_ptr.h:361
#2  0x00007fffbd989f34 in SwTextFrame::GetMergedPara() const (this=0x0) at sw/source/core/inc/txtfrm.hxx:442
#3  0x00007fffbe330020 in SwTextFrame::GetTextNodeForParaProps() const (this=0x0) at sw/source/core/text/txtfrm.cxx:1297
#4  0x00007fffbdf2dd3a in SwAutoFormat::BuildHeadLine(unsigned short) (this=0x7fffffffbfe0, nLvl=2) at sw/source/core/edit/autofmt.cxx:1904
#5  0x00007fffbdf30b98 in SwAutoFormat::SwAutoFormat(SwEditShell*, SvxSwAutoFormatFlags const&, SwNodeIndex const*, SwNodeIndex const*) (this=0x7fffffffbfe0, pEdShell=
    0x55555a341a30, rFlags=..., pSttNd=0x555556577de8, pEndNd=0x555556577da0) at sw/source/core/edit/autofmt.cxx:2520

The purpose of the : at the end seems to indicate that this should become a header3 paragraph style - gleaned from autofmt.cxx:2520.

A proposed fix is at http://gerrit.libreoffice.org/c/core/+/109413
Comment 5 Commit Notification 2021-01-18 10:19:41 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#136704 sw autofmt: prevent crash if no nextNode

It will be available in 7.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 6 Commit Notification 2021-01-18 12:48:50 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/4ef34f805c5682594a76802fff98889bd6052c3c

tdf#136704 sw autofmt: prevent crash if no nextNode

It will be available in 7.1.1.

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 7 Commit Notification 2021-01-18 12:49:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/008dc7a128c1f49093eefadc83c125c3c6b1bb00

tdf#136704 sw autofmt: prevent crash if no nextNode

It will be available in 7.0.5.

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 8 Xisco Faulí 2021-01-19 10:52:17 UTC
Verified in

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 4e1294b7d6f8de981147f15d4ca1b4e4853249eb
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Justin Luth, thanks for fixing this issue!!
Comment 9 Commit Notification 2021-01-19 20:18:22 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#136704: sw_uiwriter2: Add unittest

It will be available in 7.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 2021-01-21 10:22:40 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1-0":

https://git.libreoffice.org/core/commit/41bf539dfdec3640c8a03af0594ce1ff3846feab

tdf#136704 sw autofmt: prevent crash if no nextNode

It will be available in 7.1.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.