Bug 118859 - Crash when two Fields are empty, on same line and inside a table and hide paragraphs of empty fields active
Summary: Crash when two Fields are empty, on same line and inside a table and hide par...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.1 rc
Hardware: All All
: highest critical
Assignee: Mike Kaganski
URL:
Whiteboard: target:6.2.0 target:6.1.1
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2018-07-20 16:07 UTC by Dom Walden
Modified: 2018-08-22 16:37 UTC (History)
5 users (show)

See Also:
Crash report or crash signature: ["SwDoc::RemoveInvisibleContent()"]


Attachments
Spreadsheet for use in reproduction (8.60 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-07-20 16:08 UTC, Dom Walden
Details
screenshot showing what I mean with respect to address elements (18.51 KB, image/png)
2018-07-20 16:11 UTC, Dom Walden
Details
bt with debug symbols (11.82 KB, text/plain)
2018-07-23 15:43 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dom Walden 2018-07-20 16:07:56 UTC
Description:
I have a document which includes two Fields side-by-side, e.g.
---
<Field1> <Field2>
---
If they are inside a table cell and my database contains an entry where both of
those fields are empty, if I do something like "Edit Individual Documents" or
"Save Merged Documents", LibreOffice exits unexpectedly.

This only happens when the option in Tools > Options > LibreOffice Writer >
Compatibility > "Hide paragraphs of database fields (e.g., mail merge) with an
empty value" is selected.

It does NOT happen when that option is unselected but the "Suppress lines with
just empty fields" option in the Mail Merge Wizard is selected.

Also, it only happens if there is one or more newlines before the table.

I have a crash report:
https://crashreport.libreoffice.org/stats/crash_details/a5eceb8e-23a4-4287-8fe5-052fe12dc69d

Steps to Reproduce:
Easiest way of reproducing (probably...) is using the Mail Merge Wizard, as it
puts the Address Block in a table.
1. Create a new Writer document
2. Go to Tools > Options > LibreOffice Writer > Compatibility and check that "Hide paragraphs of database fields..." is ticked. Tick it if not and click OK.
3. Select Tools > Mail Merge Wizard...
4. Check radio button "Use current document" and click Next.
5. Check radio button "Letter" and click Next.
6. Click "Select Different Address List...", click Add and select the attached spreadsheet. Highlight the newly added spreadsheet and press OK.
7. Make sure "This document shall contain an address block" is ticked. Click More and then click New.
8. Add two address elements, "<First Name>" and "<Last Name>" on the same line (attached screenshot showing what I mean). Click OK and then OK again.
9. Click "Match Fields..." and check that "<First Name>" and "<Last Name>" are matched to the fields "First Name" and "Last Name" respectively. Do so if not. Click OK and then Next.
10. Untick (if it is not already unselected) "This document should contain a salutation" (I do not think it makes a difference). Click Next and then Finish.
11. Then click something like "Edit Individual Documents" or "Save Merged Documents".

Possibly also happens if you Print or Email, but I have not tried.

Can also reproduce this by adding Fields via Insert > Field > More Fields >
Database, and inserting fields into a table. Just remember to place the table
not at the very top of the document, but add one or more newlines before it.

Actual Results:
LibreOffice will exit unexpectedly/crash.

Expected Results:
Not crash.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 6.1.0.1
Build ID: 378e26bd4f22a135cef5fa17afd5d4171d8da21a
CPU threads: 2; OS: Linux 3.16; UI render: default; VCL: gtk2; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded

Also reproduced on:
Version: 6.1.0.1.0+
Build ID: 4e5248f32d8fdfd4655bd15bd60d83e9a0c6e540
CPU threads: 2; OS: Linux 3.16; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:libreoffice-6-1, Time: 2018-07-19_00:36:46
Locale: en-GB (en_GB.UTF-8); Calc: group threaded

My system is Debian 8.11.
Comment 1 Dom Walden 2018-07-20 16:08:59 UTC
Created attachment 143658 [details]
Spreadsheet for use in reproduction
Comment 2 Dom Walden 2018-07-20 16:11:15 UTC
Created attachment 143660 [details]
screenshot showing what I mean with respect to address elements
Comment 3 Dom Walden 2018-07-20 16:13:00 UTC
I guess this is related both to bug 102998 and (in particular) bug 35798.
Comment 4 Xisco Faulí 2018-07-20 17:38:11 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=db04be037b611e296ef9f2542322c52ed82d7a2b

Author	Mike Kaganski <mike.kaganski@collabora.com>	2018-05-18 18:48:38 +0300
committer	Mike Kaganski <mike.kaganski@collabora.com>	2018-05-20 13:16:28 +0200
commit	db04be037b611e296ef9f2542322c52ed82d7a2b (patch)
tree	8892aa251d751037c592b3aeb4e521d067944837
parent	d3122433616d4da2c6ee82f73bd8f591ea498fc0 (diff)
tdf#35798: Hide empty Database fields' paragraphs (+ compat option)

Bisected with: bibisect-linux64-6.1

Adding Cc: to Mike Kaganski
Comment 5 Julien Nabet 2018-07-23 15:43:28 UTC
Created attachment 143719 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated 2 days ago, I got an assert, see bt.
Comment 6 Julien Nabet 2018-07-23 15:44:32 UTC
Michael: I don't know if the assert is related to the bugtracker but I put you in cc since the assert has been added with https://cgit.freedesktop.org/libreoffice/core/commit/?id=ab1b2a0d6243f03849b7ac80962d08760ada6418
Comment 7 Mike Kaganski 2018-08-05 11:25:42 UTC
https://gerrit.libreoffice.org/58612
Comment 8 Commit Notification 2018-08-05 14:26:10 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#118859: Avoid trying to remove already removed nodes

It will be available in 6.2.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 9 Mike Kaganski 2018-08-05 15:49:47 UTC
Backport to 6.1: https://gerrit.libreoffice.org/58619
Comment 10 Commit Notification 2018-08-07 16:47:57 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3c20597ada7f74a4a96dec841264593fdbf0bcd5&h=libreoffice-6-1

tdf#118859: Avoid trying to remove already removed nodes

It will be available in 6.1.1.

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 11 Xisco Faulí 2018-08-07 16:52:33 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: c86a47a9d3debbc7e8ee6247f573e7f98c611f19
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Mike Kaganski, thanks for fixing this!!
Comment 12 Commit Notification 2018-08-16 13:07:30 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#119294: reimplement fix for tdf#118859

It will be available in 6.2.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 13 Commit Notification 2018-08-22 16:37:49 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b14bc12eee887b8a892f2bb114ffd50448a74d74&h=libreoffice-6-1

tdf#119294: reimplement fix for tdf#118859

It will be available in 6.1.1.

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.