Issue 120389 - OO crashes when I Print
Summary: OO crashes when I Print
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: printing (show other issues)
Version: 3.4.0
Hardware: All All
: P1 (highest) Major (vote)
Target Milestone: 3.4.1
Assignee: Oliver-Rainer Wittmann
QA Contact:
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2012-07-27 06:04 UTC by arthurgoldberg
Modified: 2016-11-03 07:42 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---
jsc: 3.4.1_release_blocker+


Attachments
see title (12.64 KB, application/vnd.oasis.opendocument.text)
2012-07-27 06:04 UTC, arthurgoldberg
no flags Details
crash dump (62.78 KB, text/plain)
2012-07-27 06:07 UTC, arthurgoldberg
no flags Details
input file 1 (12.64 KB, application/vnd.oasis.opendocument.text)
2012-07-27 06:09 UTC, arthurgoldberg
no flags Details
input file 2 (12.37 KB, application/vnd.oasis.opendocument.text)
2012-07-27 06:10 UTC, arthurgoldberg
no flags Details
patch to solve this defect (1.96 KB, patch)
2012-08-09 19:30 UTC, Oliver-Rainer Wittmann
orw: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description arthurgoldberg 2012-07-27 06:04:32 UTC
Created attachment 78749 [details]
see title

OO 3.4 repeatedly and reproducably crashes when I've a couple of writer docs open and I print. 

Unfortunately, I cannot send you the files that cause reliable crashes, as they contain private info.  so I modified them by replacing and inserting some chars; printing "crash test 2" appears to reliably crash OO.

I include a couple of crash dumps from these, as well as some other dumps when editing different files.

Arthur
Comment 1 arthurgoldberg 2012-07-27 06:07:47 UTC
Created attachment 78750 [details]
crash dump
Comment 2 arthurgoldberg 2012-07-27 06:09:18 UTC
Created attachment 78751 [details]
input file 1
Comment 3 arthurgoldberg 2012-07-27 06:10:20 UTC
Created attachment 78752 [details]
input file 2

second input file
Comment 4 arthurgoldberg 2012-08-09 13:32:38 UTC
Wow! Absolutely no response in 10 days.
I see this as strong evidence that OpenOffice is, sadly, dying. Can anyone persuade me otherwise?
If not, I'll plan accordingly.

Thanks for the fun ride
Arthur
Comment 5 Ariel Constenla-Haile 2012-08-09 14:10:27 UTC
I can only reproduce the crash on Fedora Linux x86-64 with attachment 78752 [details]
Reproduced on AOO341 m1 9593 revision 1369843 

It crashes even if you don't print:

- open document in attachment 78752 [details]
- open the dialog from "File" - "Print..."
- Press the "Cancel" button
- AOO crashes.

Confirming
Requesting release blocker status.
Comment 6 Ariel Constenla-Haile 2012-08-09 14:11:59 UTC
(In reply to comment #4)
> Wow! Absolutely no response in 10 days.
> I see this as strong evidence that OpenOffice is, sadly, dying. Can anyone
> persuade me otherwise?

Many of us are volunteers, working on our spare time; so sometimes you have to make a little noise, to get attention on your bug. ;)
Comment 7 Oliver Brinzing 2012-08-09 14:40:35 UTC
>- open document in attachment 78752 [details]
>- open the dialog from "File" - "Print..."
>- Press the "Cancel" button
>- AOO crashes.

i can reproduce crash on win 7 64bit with aoo3.4.1 rev 1369843
Comment 8 Oliver-Rainer Wittmann 2012-08-09 16:21:13 UTC
taking for further investigation to find root cause and a possible solution.

I could reproduce a crash on Windows 7 using the description in comment https://issues.apache.org/ooo/show_bug.cgi?id=120389#c5 with
- released AOO 3.4
- AOO 3.4.1 developer snapshot, rev. 1354891
- AOO 3.4.1 developer snapshot, rev. 1369110
- my local trunk build, rev. 1367858
Comment 9 Oliver-Rainer Wittmann 2012-08-09 16:27:26 UTC
OOo 3.4 Beta also crashes when reproducing the steps from comment #5
Comment 10 Oliver-Rainer Wittmann 2012-08-09 16:28:36 UTC
adjusting platform accordingly.
Comment 11 jsc 2012-08-09 16:51:36 UTC
der release blocker flag
Comment 12 Oliver-Rainer Wittmann 2012-08-09 17:25:22 UTC
crash is triggered by print options for comments. As long as option "None" is chosen no crash occurs.

simplified steps to reproduce the crash:
- new text document
- Menu Tools - Option - Writer - Print
- options for comments
-- choose "only Comments" or "end of document" or "end of page"
- confirm option dialog
- Menu File - Print
- Print or Cancel print
--> crash
Comment 13 arthurgoldberg 2012-08-09 19:28:43 UTC
Thanks everyone. I've converted Importance to Major.
Comment 14 Oliver-Rainer Wittmann 2012-08-09 19:29:32 UTC
root cause:
For the print of the comments an own document (<SwDoc> instance) and an own view shell (<ViewShell> instance) are created. The later deletion of this view shell also deletes the created document. The deletion of the document triggers certain notifications to the still existing layout. This triggers updates on the view shell which is already "half" deleted. --> accessing "dead" memory --> crash.

So far I did not find the change made to OOo 3.4 Beta which triggers this defect.

solution:
The render data (<SwRenderData> instance) which creates the document and the view shell takes now explicit ownership of the document by corresponding <acquire()> call. Thus, the deletion of the view shell does not trigger the deletion of the document anymore. But, the render data itself has to release the document and (if needed) has to delete the document. Patch will be attached soon.

note:
During debugging I recognized a memory leak. The document and the view shell for printing comments are created more than once by the print dialog without triggering a deletion of former created once. The patch will also solves this.
Comment 15 Oliver-Rainer Wittmann 2012-08-09 19:30:11 UTC
Created attachment 78898 [details]
patch to solve this defect
Comment 16 Oliver-Rainer Wittmann 2012-08-09 19:34:14 UTC
After some further local test I will commit the patch.
Comment 17 Oliver-Rainer Wittmann 2012-08-09 19:34:36 UTC
Comment on attachment 78898 [details]
patch to solve this defect

requesting review of patch
Comment 18 Ariel Constenla-Haile 2012-08-10 02:10:50 UTC
The patch on attachment 78898 [details] works fine.

@ arthurgoldberg: note that selecting in the Options dialog to print no comments at all won't solve the issue with your document that crashes (not until this fix is applied and released), because that print option is stored inside the document.
I couldn't find a way to modify this document print setting in the user interface, but if you want to print that document anyway, you can use a macro to change the option:


Sub SetPrintAnnotationMode
Dim oDoc as Object
oDoc = ThisComponent
If HasUnoInterfaces( oDoc, "com.sun.star.lang.XServiceInfo") and _
	oDoc.supportsService("com.sun.star.text.TextDocument") Then
	Dim oDocSettings as Object
	oDocSettings = oDoc.createInstance("com.sun.star.text.DocumentSettings")
	oDocSettings.setPropertyValue("PrintAnnotationMode",_
		com.sun.star.text.NotePrintMode.NOT)
End If
End Sub


Run this macro on every document that crashes when trying to print it.
It has the drawback that comments won't be printed, but at least lets you print the document.
Comment 19 Oliver-Rainer Wittmann 2012-08-10 05:34:49 UTC
@Ariel: 
Thanks for reviewing the patch.

@arthurgoldberg:
The print option for comments can be changed in the UI via Menu - Tools - Writer - Print. But afterwards you have to save the document, close it and reopen it before you try to print it.
Comment 20 Oliver-Rainer Wittmann 2012-08-10 05:36:35 UTC
Comment on attachment 78898 [details]
patch to solve this defect

another try to request the patch review ;-)
Comment 21 Armin Le Grand 2012-08-10 09:01:38 UTC
ALG: Updated my AOO34 trunk, built, installed, used comment12 -> crash. Applied patch/attachment 78898 [details], built, updated sw libs, used comment12 -> works. Tried on win7. Patch looks good, source changes make sense.
Comment 22 SVN Robot 2012-08-10 10:52:33 UTC
"orw" committed SVN revision 1371648 into trunk:
#120389# - Printing in Writer
Comment 23 SVN Robot 2012-08-10 11:09:33 UTC
"orw" committed SVN revision 1371655 into branches/AOO34:
#120389# - Printing in Writer
Comment 24 Li Feng Wang 2012-08-13 01:49:20 UTC
According comments, I change status to Resolved.
Comment 25 arthurgoldberg 2012-08-13 15:25:57 UTC
(In reply to comment #19)
> @Ariel: 
> Thanks for reviewing the patch.
> 
> @arthurgoldberg:
> The print option for comments can be changed in the UI via Menu - Tools -
> Writer - Print. But afterwards you have to save the document, close it and
> reopen it before you try to print it.

@Oliver-Rainer
Thanks for your great work investigating and patching this bug.

@Ariel and @Oliver-Rainer
Thanks much for your printing work-arounds: I find that preferences - writer - print - comments <- "none" immediately before printing avoids a crash. However, closing and reopening the file restores comments to "end of page".  but that's fine, I can print reliably, and will install the upgrade when it's released.

Thanks again everyone else who helped too.
Arthur
Comment 26 Li Feng Wang 2012-08-14 02:48:47 UTC
Verify pass according Comment12, with AOO341 r1372282 on Window XP, Redhat and Mac
Comment 27 Oliver-Rainer Wittmann 2012-10-03 18:46:47 UTC
Comment on attachment 78898 [details]
patch to solve this defect

defect fixed