Issue 123672

Summary: Particular.ods will CRASH when attempt page preview
Product: Calc Reporter: Dan Donkers <donks>
Component: viewingAssignee: Armin Le Grand <Armin.Le.Grand>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: Armin.Le.Grand, gzn.conundrum, issues, rainerbielefeld_ooo_qa, replevin11, smc967
Version: 4.0.0Keywords: crash, regression
Target Milestone: 4.1.0   
Hardware: PC   
OS: Windows, all   
See Also: https://issues.apache.org/ooo/show_bug.cgi?id=123063
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Spreadsheet for personal planning, with some simple calculations included
none
Reduced Sample Document none

Description Dan Donkers 2013-11-10 21:49:29 UTC
When I attempt to preview the page that I am working on, the file crashes. I have tried using the icon in the header bar, and also using File/Print preview, but the same result for both.

Yesterday, I was working with a different calc file and the same issue happened. I had page breaks inserted in the file on the tab that I was working on, removed the page break and then the page preview operated correctly. I removed all of the page breaks on this file, but still receive a crash.

While I am writing this, I remembered that the current file has print ranges in use. When I remove all of the print ranges of the file, then the page preview operates properly.

As an aside, there are 2 other issues that may be related or may not be.

First, while the print ranges are in use, the current file does not appear in the list of recent documents under File, but it does now after removing the print ranges.

Second, when the program crashed, the page appeared that said an error report was being generated, but nothing showed up for me to view or submit.
Comment 1 Rainer Bielefeld 2013-11-11 05:29:08 UTC
NOT  reproducible with server installation of "AOO 4.1.0-Dev – German  UI / German locale - [AOO410m1(Build:9750)  -  Rev. 1537973 - 2013-11-03]" on German WIN7 Home Premium (64bit)", own separate user profile. Most of my Calc documents have print ranges and manual page breaks, I never observed such crashes.

@Dan Donkers
Please attach a sample document.
Comment 2 smc967 2013-11-13 00:46:04 UTC
Unable to replicate:  AOO401m5(Build:9714)  -  Rev. 1524958
Windows 7 Home Premium 64bit.  Page preview works fine with print ranges defined and page breaks.  Example file would be helpful.
Comment 3 replevin11 2013-11-14 19:06:37 UTC
replevin 11/14/2013

Unable to replicate bug on Windows 8 64 bit, AOO401m5 Build 9714 Rev 1524958 Ver 4.0.1. 

Alternate replication steps: 
1. Typed in content. 
2. Insert > Manual Break > Row Break
3. Selected content
4. Format > Print Ranges > Define
5. File > Page Preview
6. Clicked the page preview button.
Comment 4 Dan Donkers 2013-11-17 21:35:46 UTC
Created attachment 81947 [details]
Spreadsheet for personal planning, with some simple calculations included

As per requests, here is the file that I was working on. My apologies for the delay in posting this, but I was called out of town on short notice, and also this file contained some personal information that I did not want to make public. With that in mind, I have removed the personal information and left any formulas that were included.

In a previous attempt to prepare this file, I started to delete some of the sheets that were part of the file, and attempting the page preview. On some of the later sheets there are some formulas, and after those pages were deleted, the page preview operated again without crashing. 

The file that is included now, I have confirmed that the document will crash as it is posted.

For the record, if it matters, I am using Windows 8 and AOO401m5 (Build 9714 - Rev1524958) 2013-09-20 11:40:29.

As an aside, yesterday I was working on a different spreadsheet file that also included some page breaks. The preview worked properly, but the file crashed when I tried to insert some lines. If I removed the page break (only on the page that I was trying to insert the lines to) and then inserted the lines and added the page break again, the preview worked properly.
Comment 5 Rainer Bielefeld 2013-11-17 21:40:26 UTC
CRASH is Reproducible with server installation of "AOO 4.1.0-Dev – English  UI / English locale - [AOO410m1(Build:9750)  -  Rev. 1537973 - 2013-11-03]" on German WIN7 Home Premium (64bit)", own separate user profile.

I will do some further tests tomorrow
Comment 6 Rainer Bielefeld 2013-11-18 05:18:30 UTC
Created attachment 81948 [details]
Reduced Sample Document

Further Tests with "AOO 4.0.1   – German UI / German locale  [Rev. 1524958 2013-09-20 11:40:29]" on  German WIN7 Home Premium (64bit)", “historic”  4.0  User Profile used for all  predecessor versions show that a document reduced to  sheet "Annual Budget" also reproduces the bug. No idea what is the root of the crash
Comment 7 Rainer Bielefeld 2013-11-18 05:35:46 UTC
Additional Info:
-----------------
I did some tests with  Reduced Sample Document:

(a) Already Reproducible with server installation of  "AOO 4.0.0-Dev – English UI / German locale [AOO400m2(Build:9701)  -  Rev. 1493305
Rev.1491054  2013-06-14]" on German WIN7 Home Premium (64bit)", own separate user profile

(b) also crashes with server installation of  " AOO 4.0.0-Dev  – English UI / German locale [AOO400m1(Build:9700) - Rev. 1457992 – Rev.1457606  ((2013-03-19))]" on German WIN7 Home Premium (64bit)", own separate user profile, but here crash often will not happen before I close page preview to return to normal view.

(c) with server installation of  "AOO 3.4.1 – German UI / German locale [AOO341m1(Build:9593) - Rev.1372282]" on German WIN7 Home Premium (64bit)", own separate user profile

(d) Still Reproducible with server installation of "AOO 4.1.0-Dev – English  UI / English locale - [AOO410m1(Build:9750)  -  Rev. 1537973 - 2013-11-03]" on German WIN7 Home Premium (64bit)", own separate user profile. Because of incomplete LCo  selector (Bug 123063) no correct information can be contributed.
Comment 8 Armin Le Grand 2014-02-25 00:45:47 UTC
Opens on win7 with 'AOO410m1(Build:9750)  -  Rev. 1569541', no crash, no assertions, but nearly all cells show '#DIV/0!'
Comment 9 Rainer Bielefeld 2014-02-25 05:38:50 UTC
(In reply to Armin Le Grand from comment #8)
> Opens on win7 with 'AOO410m1(Build:9750)  -  Rev. 1569541', no crash, no
> assertions, but nearly all cells show '#DIV/0!'

What test did you do? Crash still reproducible with sample document "2013-11-18 06:18 CET, Rainer Bielefeld " and server installation of "AOO 4.1.0-Dev – English UI / German locale - [AOO410m1(Build:9750) - Rev. 1566800 - 2014-02-12]" on German WIN7 Home Premium (64bit)", own separate user profile: After document opened simply click page preview icon in Standard toolbar.
Comment 10 Armin Le Grand 2014-02-25 20:29:33 UTC
Hi Rainer, yes, it still happens with using preview, I just did a load test. In the debugger when I continue at all the interruptions, I get the preview visible. Doing some checks...
Comment 11 Armin Le Grand 2014-02-26 01:17:19 UTC
Looks as if mem in ScPrintFunc gets corrupted; the ~ScPrintFunc() crashes when trying to free members pPageEndX, pPageEndY and pPageRows, so these seem to be used wrong. They are allocated as simple arrays in ScPrintFunc::CalcPages() and the size of the array of SCROW for pPageEndY and of ScPageRowEntry for pPageRows is calculated first. When debugging I see that ScPrintFunc::CalcPages() gets called a 2nd time for the same instance leading to a bigger result for Y-Size, but no reallocation is done. Thus, mem behind the alloced stuff may be written/changed...
Comment 12 Armin Le Grand 2014-02-26 01:33:00 UTC
Seems to have to do with r1391359 which is #121136# 'Improve Spreadsheet performance in some area (Patch 1)'. This seems not to have takeninto account that mem requirements may change dynamically...
Comment 13 Armin Le Grand 2014-02-26 01:35:30 UTC
Indeed, that's the problem. I added a dynamic adaption and all works well. I will change members

	SCCOL*              pPageEndX;			// Seitenaufteilung
	SCROW*              pPageEndY;
	ScPageRowEntry*		pPageRows;

to std::vector and see if that cleaner version will work when enlarging these vectors dynamically as needed...
Comment 14 Armin Le Grand 2014-02-26 02:55:13 UTC
Works as expected. I have to call the former changes a 'hack' since it is dangerous and unsafe. It may be the reason for other crashes as well.

Also saw that the zoom slider in page preview does not work, but this is the same in AOO 3.4.0 already, so no regression.

Preparing commit...
Comment 15 SVN Robot 2014-02-26 03:04:14 UTC
"alg" committed SVN revision 1571902 into trunk:
i123672 Made data used in ScPrintFunc to prepare print preview dynamic
Comment 16 Armin Le Grand 2014-02-26 03:06:05 UTC
Added regression keyword (from AOO341), grepped, set flags
Comment 17 Armin Le Grand 2014-02-26 03:12:33 UTC
Preparing to add to branch AOO410...
Comment 18 Armin Le Grand 2014-02-26 03:22:22 UTC
Checked and works in branch, preparing commit...
Comment 19 Armin Le Grand 2014-02-26 03:23:29 UTC
Okay, done.
Comment 20 SVN Robot 2014-02-26 03:28:42 UTC
"alg" committed SVN revision 1571903 into branches/AOO410:
i123672 Made data used in ScPrintFunc to prepare print preview dynamic
Comment 21 Oliver-Rainer Wittmann 2014-04-02 11:49:17 UTC
Verified on Ubuntu 10.04 (64bit) with build from branch AOO410 (rev. 1583666)

Verified on Windows 7 with local build of branch AOO410, rev. 1582710 and with buildbot build, rev. 1582709
Comment 22 Rainer Bielefeld 2014-04-16 06:06:41 UTC
*** Issue 123701 has been marked as a duplicate of this issue. ***