Bug 107126 - Crash on changing page type in document (editing) with many footnotes (steps in comment 14)
Summary: Crash on changing page type in document (editing) with many footnotes (steps ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: highest critical
Assignee: Michael Stahl
QA Contact:
URL:
Whiteboard: target:5.4.0 target:5.3.3
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2017-04-12 18:39 UTC by matt
Modified: 2017-07-10 15:43 UTC (History)
3 users (show)

See Also:
Crash report or crash signature: ["SwTextFrameBreak::SwTextFrameBreak(SwTextFrame *,long)"]


Attachments
Backtrace ending at SwFtnBossFrm::RearrangeFtns (18.68 KB, text/plain)
2017-04-12 18:39 UTC, matt
Details
Screencast of crash (459.48 KB, video/webm)
2017-04-12 18:50 UTC, matt
Details
simplify document (22.82 KB, application/vnd.oasis.opendocument.text)
2017-04-17 17:22 UTC, Xisco Faulí
Details
bt with debug symbols + console and gdb logs (5.94 KB, text/plain)
2017-04-17 20:24 UTC, Julien Nabet
Details
bt from "GetItemSetForPreview not implemented for page or number or table style" (8.11 KB, text/plain)
2017-04-17 20:54 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matt 2017-04-12 18:39:00 UTC
Created attachment 132522 [details]
Backtrace ending at SwFtnBossFrm::RearrangeFtns

Please feel free to email for a test document, I don't want to upload it here. It is a 13 page document with 51 footnotes. Similar crashes have been happening as I build the document out, so it is likely reproducible with fewer pages also.

Attached is the backtrace.
Comment 1 matt 2017-04-12 18:40:29 UTC
Steps:

Open document as described above.
Click any page.
Change page type from a type without footers to a type with footers.
Boom.
Comment 2 matt 2017-04-12 18:50:40 UTC
Created attachment 132523 [details]
Screencast of crash
Comment 3 Xisco Faulí 2017-04-12 19:59:48 UTC Comment hidden (obsolete)
Comment 4 matt 2017-04-12 21:17:22 UTC
Confirmed that it also crashes under the same circumstances on the latest release available for my platform:

Version: 5.2.5.1
Build ID: 1:5.2.5-2
CPU Threads: 4; OS Version: Linux 4.9; UI Render: default; VCL: gtk3; 
Locale: en-US (en_US.utf8); Calc: group

(different machine)
Comment 5 matt 2017-04-12 21:18:46 UTC
The splash screen seems to have outdated version info on that one. The package reads version "5.3.2.2-2"
Comment 6 Xisco Faulí 2017-04-12 21:43:26 UTC
Could you please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 7 matt 2017-04-13 15:54:47 UTC
It no longer crashes when I replace all of the content with "x" as suggested in the link you provided. My document contains some URLs in the footnotes, and I think that may be a clue that the bug has something to do with the calculation of positioning non-breaking segments in footnotes such as URLs. 

If a developer wishes to obtain a copy of the original, please email me privately.
Comment 8 Julien Nabet 2017-04-16 16:33:35 UTC
Could you attach a bt with a recent LO version (last stable one 5.3.2)?
Indeed, the attached one comes from a version too old to be useful.
Comment 9 matt 2017-04-16 23:18:18 UTC
I have supplied the document that consistently crashes it to Xisco Faulí privately. As I do not have the current debug version easily accessed now, I hope that you can generate your own using that document fairly easily.
Comment 10 Xisco Faulí 2017-04-17 09:06:42 UTC
(In reply to matt from comment #9)
> I have supplied the document that consistently crashes it to Xisco Faulí
> privately. As I do not have the current debug version easily accessed now, I
> hope that you can generate your own using that document fairly easily.

I'm afraid to say I haven't got any email from you containing the problematic file, so please check if you sent the email correctly
Comment 11 matt 2017-04-17 16:14:10 UTC
I have re-sent it, hopefully you got it this time? Thank you!
Comment 12 Xisco Faulí 2017-04-17 16:16:58 UTC
Reproduced in

- Version: 5.0.0.0.alpha1+
Build ID: 0db96caf0fcce09b87621c11b584a6d81cc7df86
Locale: ca-ES (ca_ES.UTF-8)

- Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

- Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)

- LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

Steps:
1. Open the document
2. Right-Click - Page
3. Organizer tab
4. Choose Envelope in Next Style
5. Click OK
Comment 13 Xisco Faulí 2017-04-17 17:22:42 UTC
Created attachment 132640 [details]
simplify document
Comment 14 Xisco Faulí 2017-04-17 17:26:35 UTC
Steps to reproduce with attached document:
1. Select 'Styles and Formatting' in the sidabar menu
2. Select Page Styles
3. Click on Default Style a few times
Comment 15 Julien Nabet 2017-04-17 20:24:22 UTC
Created attachment 132641 [details]
bt with debug symbols + console and gdb logs

On pc Debian x86-64 with master sources updated today, I could reproduce the crash by following Xisco's comment.
This line appears several times:
warn:sw.ui:27415:1:sw/source/uibase/app/docstyle.cxx:1291: GetItemSetForPreview not implemented for page or number or table style
Comment 16 Julien Nabet 2017-04-17 20:50:54 UTC
bandaid fix for the provided bt:
diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index b096df735e95..06af57b13b09 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -65,7 +65,7 @@ SwTextFrameBreak::SwTextFrameBreak( SwTextFrame *pNewFrame, const SwTwips nRst )
     if( !m_bKeep && m_pFrame->IsInSct() )
     {
         const SwSectionFrame* const pSct = m_pFrame->FindSctFrame();
-        m_bKeep = pSct->Lower()->IsColumnFrame() && !pSct->MoveAllowed( m_pFrame );
+        m_bKeep = pSct && pSct->Lower()->IsColumnFrame() && !pSct->MoveAllowed( m_pFrame );
     }
     m_bKeep = m_bKeep || !m_pFrame->GetTextNode()->GetSwAttrSet().GetSplit().GetValue() ||
         m_pFrame->GetTextNode()->GetSwAttrSet().GetKeep().GetValue();
but perhaps it would just hide the root cause.

Michael: thought you might be interested in this one.
Comment 17 Julien Nabet 2017-04-17 20:54:13 UTC
Created attachment 132642 [details]
bt from "GetItemSetForPreview not implemented for page or number or table style"

bt from warn:sw.ui:27415:1:sw/source/uibase/app/docstyle.cxx:1291: GetItemSetForPreview not implemented for page or number or table style
Comment 18 Michael Stahl 2017-04-21 22:02:08 UTC
what makes this crash is the section in the last footnote - it barely doesn't fit on the 3rd page but it's trying very hard.

fixed on master
Comment 19 Commit Notification 2017-04-21 22:13:20 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#107126 sw: fix layout crash with section in footnote

It will be available in 5.4.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 20 Julien Nabet 2017-04-24 20:31:07 UTC
With master sources updated yesterday, I don't reproduce this.

Thank you Michael!
Comment 21 Xisco Faulí 2017-04-27 08:52:31 UTC
Verified in

Version: 5.4.0.0.alpha0+
Build ID: 7c11fe076005ed4e28f04f14990b7011a03a4517
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 22 Commit Notification 2017-04-27 20:15:12 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0ae68775afc6227afb881e28c1b2045b3030ad53&h=libreoffice-5-3

tdf#107126 sw: fix layout crash with section in footnote

It will be available in 5.3.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 23 Commit Notification 2017-05-03 10:45:38 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ecd21ca76a5f3d81e6f74b167f4a07bafa4f148f&h=libreoffice-5-3-3

tdf#107126 sw: fix layout crash with section in footnote

It will be available in 5.3.3.

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 24 Julien Nabet 2017-05-03 11:47:39 UTC
Let's simplify targets in Whiteboard field.