Bug Hunting Session
Bug 116527 - Crash in: `anonymous namespace'::documentStartPageNumber
Summary: Crash in: `anonymous namespace'::documentStartPageNumber
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.5.1 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:6.0.5
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2018-03-20 20:41 UTC by muesliflyer
Modified: 2018-06-18 18:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["`anonymous namespace'::documentStartPageNumber","`anonymous namespace'::CursorStateHelper::SetCursorToMark"]


Attachments
Test files to replicate the problem (13.66 KB, application/x-zip-compressed)
2018-03-20 20:41 UTC, muesliflyer
Details
gdb backtrace (33.35 KB, text/plain)
2018-03-21 10:45 UTC, Xisco Faulí
Details
screencast (4.69 MB, video/x-matroska)
2018-03-22 11:59 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description muesliflyer 2018-03-20 20:41:55 UTC
Created attachment 140760 [details]
Test files to replicate the problem

This bug was filed from the crash reporting server and is br-cd1600ac-f45a-4bf4-8355-b64996a08db6.
=========================================

I caused this crash by entering From page number = 0 and To page number = 0 into the mail merge print dialog. A check should probably be added to prevent such "stupid" values.

But this crash is not the main problem. The problem is that different page ranges result in strange page ranges to be printed. I have a single page Writer document and a Calc table with three records as the data source. Here is what I get for different record ranges:

From To Result
1    1  Prints the document filled with data from first record. Fine.
2    2  Prints document with data from *third* record!
3    3  Error message: No pages to be printed available (I am translating from German
1    3  Prints all three pages. Fine.
2    3  Prints document with data from *third* record only!

I could not find a bug in mmresultdialogs.cxx that could explain this behavior. Maybe someone can help.

Comment: I get the impression that Writer first generates an output document with all pages from all data source records and then prints a page range from this output document. Shouldn't it be better to generate an output document only for the selected data source record range and then print all of that document?
Comment 1 Xisco Faulí 2018-03-21 10:24:18 UTC
Crash Reproduced in

Version: 6.0.3.1
Build ID: 1:6.0.3~rc1-0ubuntu0.16.04.1
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Let's use this report for the crash.

Regarding your second problem, please report it in a separate ticket. Thanks
Comment 2 Xisco Faulí 2018-03-21 10:25:35 UTC
Same happens if a char is introduced...
Comment 3 Xisco Faulí 2018-03-21 10:45:14 UTC
Created attachment 140778 [details]
gdb backtrace
Comment 4 Xisco Faulí 2018-03-21 10:49:04 UTC
@Julien, one for you ?
Comment 5 muesliflyer 2018-03-21 11:44:09 UTC
As requested by Xisco, I created a ticket for the problem with the mail merge print ranges:
https://bugs.documentfoundation.org/show_bug.cgi?id=116537
Comment 6 Julien Nabet 2018-03-21 21:15:16 UTC
On pc Debian x86-64 with master sources updated today, Mail merge print dialog doesn't give the possibility to choose a value < 1 for "From" or "To".
Comment 7 Xisco Faulí 2018-03-22 11:59:25 UTC
Created attachment 140812 [details]
screencast
Comment 8 Xisco Faulí 2018-03-22 12:00:22 UTC
(In reply to Julien Nabet from comment #6)
> On pc Debian x86-64 with master sources updated today, Mail merge print
> dialog doesn't give the possibility to choose a value < 1 for "From" or "To".

That's weird. I've created a screencast to make it clearer...
Comment 9 Julien Nabet 2018-03-24 10:55:19 UTC
Thank you Xisco for the screencast, I could reproduce the crash.
Comment 10 Julien Nabet 2018-03-24 11:42:41 UTC
I think it should be fixed in UI interface.
I mean if you open the odt file and click "Print", it displays:
"Your document contains address database fields. Do you want to print a letter form?"
Clicking "Yes" brings a "Mail Merge" dialog (mailmerge.ui) which prevents values "From" and "To" from being below 1.
I think we should mimick this behavior.
If it's confirmed, I don't know anything about UI/Glade to do this.
Moreover, there are quite a confusion between: sal_uInt32, sal_Int32 and int.
I also saw that NumericField was used and is made from NumericFormatter which contains a value with type sal_Int64. 
In brief, not for me.
Comment 11 Xisco Faulí 2018-03-25 15:16:19 UTC
(In reply to Julien Nabet from comment #10)
> I think it should be fixed in UI interface.
> I mean if you open the odt file and click "Print", it displays:
> "Your document contains address database fields. Do you want to print a
> letter form?"
> Clicking "Yes" brings a "Mail Merge" dialog (mailmerge.ui) which prevents
> values "From" and "To" from being below 1.
> I think we should mimick this behavior.
> If it's confirmed, I don't know anything about UI/Glade to do this.
> Moreover, there are quite a confusion between: sal_uInt32, sal_Int32 and int.
> I also saw that NumericField was used and is made from NumericFormatter
> which contains a value with type sal_Int64. 
> In brief, not for me.

Hi Julien,
Ok, no problem, thanks for taking a look anyway.

@Caolán, since this issue concerns the UI, would you mind taking a look?
Comment 12 Caolán McNamara 2018-06-01 08:43:33 UTC
I think I fixed the ui in passing with...

commit c0af8057188c0e95831f9e6d1ef96a424da6f9b2
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Fri Apr 20 13:05:24 2018 +0100

    weld SfxPrintOptionsDialog
    
    and SwMMResultPrintDialog


so this is fixed in master/6-1. I will backport the min value bit for 6-0
Comment 13 Caolán McNamara 2018-06-01 08:58:14 UTC
https://gerrit.libreoffice.org/#/c/55167/ for 6-0, fixed in master/6-1 already
Comment 14 Xisco Faulí 2018-06-07 09:04:27 UTC
Verified in

Version: 6.1.0.0.beta1+
Build ID: 8b96445766efe237eb47608ade6c147673466e2e
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Caolán, Thanks for fixing this!!
Comment 15 Commit Notification 2018-06-13 02:36:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

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

Resolves: tdf#116527 backport min value setting for print mailmerge range

It will be available in 6.0.6.

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 16 Commit Notification 2018-06-18 10:12:44 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-0-5":

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

Resolves: tdf#116527 backport min value setting for print mailmerge range

It will be available in 6.0.5.

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.