Printing doesn't work after Print Previewing a mail-linux only.

RESOLVED FIXED in mozilla1.4beta

Status

MailNews Core
Printing
P2
normal
RESOLVED FIXED
16 years ago
10 years ago

People

(Reporter: Pratik, Assigned: Pratik)

Tracking

Trunk
mozilla1.4beta
x86
Linux
Bug Flags:
blocking1.4b +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

609 bytes, patch
smontagu
: review+
Details | Diff | Splinter Review
1.61 KB, patch
Details | Diff | Splinter Review
847 bytes, patch
neil@parkwaycc.co.uk
: review+
(not reading, please use seth@sspitzer.org instead)
: superreview+
Details | Diff | Splinter Review
(Assignee)

Description

16 years ago
Steps
1. Print Preview an email
2. Close the Print Preview window
3. Now try printing a mail or a web page

Actual Result:
Printing fails

On my debug builds I see the foillowing assertions when I press Print after
doing a Print Preview

###!!! ASSERTION: Cannot have more than one print device context.:
'instance_counter < 2', file /psolanki/mozilla/gfx/src/ps/nsDeviceContextPS.cpp,
line 80
Break: at file /psolanki/mozilla/gfx/src/ps/nsDeviceContextPS.cpp, line 80
###!!! ASSERTION: Cannot have more than one print device context.:
'instance_counter < 2', file /psolanki/mozilla/gfx/src/ps/nsDeviceContextPS.cpp,
line 115
Break: at file /psolanki/mozilla/gfx/src/ps/nsDeviceContextPS.cpp, line 115
(Assignee)

Comment 1

16 years ago
I think the problem here is that the first print preview throws an error and
noone catches it. I put printfs in nsDeviceContext constructor and destructor
and noticed that the object doesn't get destroyed at the end of
nsDeviceContextGTK::GetDeviceContextFor(). I'm guessing that it should be
destroyed at the end of the function. On teh console I also see this line

WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(NS_OpenURI(getter_AddRefs(in), uri)))
failed, file /psolanki/mozilla/gfx/src/ps/nsPostScriptObj.cpp, line 2838

Could that be the reason?
(Assignee)

Comment 2

16 years ago
So its turns out the problem was in msgPrintEngine.js. BrowserExitPrintPreview()
was not calling exitPrintPreview(). ccing rods since this is his code (according
to CVS blame). patch coming up..
(Assignee)

Comment 3

16 years ago
Created attachment 109845 [details] [diff] [review]
simple fix
(Assignee)

Comment 4

16 years ago
Comment on attachment 109845 [details] [diff] [review]
simple fix

Who should I ask for sr?
Attachment #109845 - Flags: review?(rods)

Updated

16 years ago
Attachment #109845 - Flags: review?(rods) → review+
(Assignee)

Comment 6

16 years ago
smontagu: Thanks for the r=
roc: thanks for the sr=

Can anyone with CVS checkin access check this in? Thanks.
checked in
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
(Assignee)

Comment 8

16 years ago
Ok. This bug is fixed but I'm trying to figure out why the following warning happens

WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(NS_OpenURI(getter_AddRefs(in), uri)))
failed, file /psolanki/mozilla/gfx/src/ps/nsPostScriptObj.cpp, line 2838

On my linux box, nsPostScriptObj::InitUnixPrinterProps() always fails with the
above warning. Is this a bug or expected behaviour? Should I file a new bug or
is it covered under some other bug?

Comment 9

16 years ago
Using trunk build 20030110 on linux I still see this problem only when I close
the print preview window with the X in the upper right corner of the title bar.  

Same scenario as the original, however specific in the way you close the Print
Preview.
Steps
1. Print Preview an email
2. Close the Print Preview window using the X in the upper right corner.
3. Now try printing a mail or a web page

Actual Result:
Printing fails until you exit the app and relaunch.

reopening and changinging summary to note Linux only.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Summary: Printing doesn't work after Print Previewing a mail → Printing doesn't work after Print Previewing a mail-linux only.

Comment 10

16 years ago
esther wrote:
> Using trunk build 20030110 on linux I still see this problem only when I close
> the print preview window with the X in the upper right corner of the title 
> bar.  
[snip]

Can you reproduce this with Mozilla's Xprint print module or is this bug
PostScript-module only ?
(Assignee)

Comment 11

16 years ago
Yup. The bug still exists when you try to press the X button. The problem is
that the Close button and the X button both call different functions. A simple
patch for this would involve either

a) Changing the function called on pressing X button from 
   OnUnloadPrintEngine() to BrowserExitPrintPreview()

b) Have OnUnloadPrintEngine() call BrowserExitPrintPreview()

c) Get rid of BrowserExitPrintPreview() and move its functionality to
   OnUnloadPrintEngine() and have Close button call OnUnloadPrintEngine()

Ideally I'd want to have both X and "Close" button call the same function. I can
whip up a patch pretty soon if I get some consensus on which approach is preferable.
(Assignee)

Comment 12

16 years ago
Its not as easy as I thought it was. I tried c) and got a JS exception. Delved
deeper and found that OnUnloadPrintEngine() gets called from both Print and
PrintPreview. But I need to do a cleanup only in Print Preview and not in Print.
So the solution to this would involve figuring out whether we are in Print
Preview or Print mode in OnUnloadPrintEngine() and then calling the cleanup
routine appropriately. I don't like this very much though. Any other ideas?

Updated

16 years ago
Priority: -- → P2
Target Milestone: --- → Future
(Assignee)

Comment 13

15 years ago
ping? Does anyone have any comments about comment #11, #12?
(Assignee)

Comment 14

15 years ago
Created attachment 120210 [details] [diff] [review]
Fixes both X button and Close button

Move the cleanup code from BrowserExitPrintPreview() to a conditional in
OnUnloadPrintEngine(). OnUnLoadPrintEngine() gets called with both X and Close
button presses while BrowserExitPrintPreview() gets called only when pressing
Close.

I also see some tab characters lurking in this file. Should I get rid of them?
(Assignee)

Updated

15 years ago
Attachment #120210 - Flags: review?(rods)
(Assignee)

Comment 15

15 years ago
Created attachment 120225 [details] [diff] [review]
This is patch 120210 + get rid of tab characters
(Assignee)

Updated

15 years ago
Attachment #120210 - Flags: review?(rods) → review?(sspitzer)
Comment on attachment 120210 [details] [diff] [review]
Fixes both X button and Close button

neil, can you test and review, and then I'll sr?
Attachment #120210 - Flags: superreview?(sspitzer)
Attachment #120210 - Flags: review?(sspitzer)
Attachment #120210 - Flags: review?(neil)

Comment 17

15 years ago
Comment on attachment 120210 [details] [diff] [review]
Fixes both X button and Close button

Sorry for not getting to this before.
Please add a space between if and (.
Attachment #120210 - Flags: review?(neil) → review+
(Assignee)

Comment 18

15 years ago
Created attachment 121435 [details] [diff] [review]
Patch 120210 with better indentation
Attachment #120210 - Attachment is obsolete: true
(Assignee)

Updated

15 years ago
Attachment #121435 - Flags: superreview?(sspitzer)
Attachment #121435 - Flags: review?(neil)

Updated

15 years ago
Attachment #121435 - Flags: review?(neil) → review+
Comment on attachment 121435 [details] [diff] [review]
Patch 120210 with better indentation

sr=sspitzer, I'll work on getting driver approval.
Attachment #121435 - Flags: superreview?(sspitzer) → superreview+
re-assign, and seeking 1.4 b approval.
Assignee: dcone → psolanki
Status: REOPENED → NEW
Flags: blocking1.4b?
Target Milestone: Future → mozilla1.4beta
I'm a driver, and I tested this fix on win32.

it's a bad bug, so as my first driver action, I'll give it 1.4b approval.

landed, so marking as fixed.

thanks to pratik for the fix, and neil for the review.
Status: NEW → RESOLVED
Last Resolved: 16 years ago15 years ago
Flags: blocking1.4b? → blocking1.4b+
Resolution: --- → FIXED
Attachment #120210 - Flags: superreview?(sspitzer)
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.