Bug Hunting Session
Bug 53210 - Writer crashes when hiding all sections
Summary: Writer crashes when hiding all sections
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.5.3 release
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium critical
Assignee: Miklos Vajna
URL:
Whiteboard: target:3.7.0 target:3.6.1 target:3.5.7
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-07 13:06 UTC by Ralf Bensmann
Modified: 2019-01-10 06:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Template containing sections hidden through a condition (11.27 KB, application/vnd.oasis.opendocument.text-template)
2012-08-07 13:06 UTC, Ralf Bensmann
Details
OS X crash log (58.23 KB, text/plain)
2012-08-07 13:06 UTC, Ralf Bensmann
Details
gdb log (11.82 KB, text/plain)
2012-08-07 13:07 UTC, Ralf Bensmann
Details
bt with symbols (7.46 KB, text/plain)
2012-08-08 20:40 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Bensmann 2012-08-07 13:06:05 UTC
Created attachment 65229 [details]
Template containing sections hidden through a condition

A document has sections and all of them are hidden through a condition. When all sections are hidden and "Tools - Update - Update all" or "Save" actions are triggered Writer crashes.

I saw this behaviour with OpenOffice 3.2 upto LibreOffice 3.5.5-3 and tested it under OS X 10.8, Debian GNU/Linux and FreeBSD 8.2.
Comment 1 Ralf Bensmann 2012-08-07 13:06:50 UTC
Created attachment 65230 [details]
OS X crash log
Comment 2 Ralf Bensmann 2012-08-07 13:07:06 UTC
Created attachment 65231 [details]
gdb log
Comment 3 Julien Nabet 2012-08-07 20:09:02 UTC
On pc Debian x86-64 with master sources updated today or with 3.5.4.2 Debian packages, I don't reproduce the pb (tried update, update all).

Did you install specific extensions ?
Could you try to reproduce with a brand new LO profile ? (seehttp://wiki.documentfoundation.org/UserProfile)
Comment 4 Ralf Bensmann 2012-08-08 09:23:02 UTC
Sorry, forgot steps to reproduce:

1. Open attached template
2. Open dialog for settings userfield values (Strg-F2)
3. Set all _CS_* userfields to value 0
4. In the menu Tools - Update - Update all or File - Save

Writer will crash.

On FreeBSD compiled LibreOffice 3.5 using /usr/ports/editors/libreoffice, on Linux I installed .debs from the download site (dpkg -i *.deb).

I can reproduce it on my Mac, on FreeBSD and on Linux. No matter running as desktop version or on server side using soffice -env:UserInstallation="file:///..." --accept= --headless, Writer crashes when setting all conditions of all sections to "false" and refresh/save.

No special setup...no extensions installed... and reproducible with vanilla profiles (deleting .libreoffice or -env:UserInstallation).
Comment 5 Julien Nabet 2012-08-08 20:40:24 UTC
Created attachment 65311 [details]
bt with symbols

Thank you for comment 4, I finally succeeded in reproducing the problem with pc Debian x86-64 and master sources updated today.

Here is a slight more detailed process to reproduce the problem:
1. Open attached template
2. Open dialog for settings userfield values (Ctrl-F2) (for non German speakers, "Strg" means "Ctrl" at least here :-))
3. Select "Variables" tab
4. In Type part, select "User Field"
5. For all the 4 _CS_* userfields, put the value to 0 and click on apply icon for each (just next to value field)
6. In the menu Tools - Update - Update all or File - Save
Comment 6 Julien Nabet 2012-08-08 20:40:48 UTC
Following my last comment, I update the status to "New".
Comment 7 Julien Nabet 2012-08-08 21:04:41 UTC
Miklos: one for you ?
Comment 8 Miklos Vajna 2012-08-10 18:15:59 UTC
The problem seems to be that there are no paragraphs outside sections in the document. If one creates a document from scratch, inserts a section, delete the "outer" paragraph then sets the section as hidden, it won't be hidden, as (I guess) Writer core doesn't really handle pages not having any paragraph.

I think we could do something similar here. Just need to find the code pointers:

1) where is the code that blocks hiding the last section in my example.

2) where is the code that removes sections from the layout (which could do a similar trick).
Comment 9 Miklos Vajna 2012-08-10 18:22:13 UTC
Thinking a bit more about this: I think the consistent behavior here would be: instead of leaving the last page without a single paragraph, unhide the last section -- this way the doc model and the layout will be in sync, and we won't crash, either.
Comment 10 Not Assigned 2012-08-10 19:14:47 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

fdo#53210 SwDoc::UpdateExpFlds don't crash when hiding all sections
Comment 11 Ralf Bensmann 2012-08-11 09:12:54 UTC
Miklos,

I think the other way round would be the best: insert/display an empty page.

When all conditions are false and no section "should" be displayed, I think nothing should/empty page should be there. I think it's more idiomatic.

My use case is a server application and even for desktop users I think it would be hard to understand why something is displayed, when all conditions are false.
Comment 12 Miklos Vajna 2012-08-13 07:49:59 UTC
Hi,

Try a daily build, and see how it works now. :-) Having all conditions as false and still displaying something would be indeed confusing. However what currently happens is that in such a situation the condition of the last section is changed to "0" (which is always false), so the section will be shown for a reason.

Miklos
Comment 13 Not Assigned 2012-08-13 09:06:29 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

fdo#53210 testcase
Comment 14 Miklos Vajna 2012-08-13 09:21:59 UTC
Fixed in master, -3-6 and -3-5 reviews:

https://gerrit.libreoffice.org/403
https://gerrit.libreoffice.org/404
Comment 15 Not Assigned 2012-08-14 09:55:11 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b5edfe152737650772504dc6464dbbb2f607f453&g=libreoffice-3-6

fdo#53210 SwDoc::UpdateExpFlds don't crash when hiding all sections


It will be available in LibreOffice 3.6.1.
Comment 16 Not Assigned 2012-08-14 10:02:14 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

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

fdo#53210 SwDoc::UpdateExpFlds don't crash when hiding all sections


It will be available in LibreOffice 3.5.7.