Closed Bug 157508 Opened 22 years ago Closed 22 years ago

[FIX]Window not closed when user cancels PrintDialog

Categories

(MailNews Core :: Printing, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME
mozilla1.2beta

People

(Reporter: rods, Assigned: rods)

Details

Attachments

(1 file)

The DV now checks to see if the "document" is busy and "queues" the print
request request. This causes a problem for mail because we try to print from the
STOP notification. Which is fine, except if a user cancels the print dialog, the
windows never gets cleaned up. Also, I think this may cause problems when
printing multiple msgs.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.1alpha
Attached patch patchSplinter Review
Adds a PLEvent to give the DV time to finish executing the STOP so the busy
flags get turned off and then we can have the DV execute the Print command
synchronously up to the print dialog instead of queueing it.
Summary: Window not closed when user cancels PrintDialog → [FIX]Window not closed when user cancels PrintDialog
Comment on attachment 91332 [details] [diff] [review]
patch

R=ducarroz
Attachment #91332 - Flags: review+
rods, sorry for the delay.  I'm having problems understanding.

Is the only problem when the user cancels the print dialog?  
What's the problem when we print multiple messages?
Can you explain why using a PL_Event fixes the problem?

If this fix turns out to be correct, this comment:

// If something bad happens here (menaing we can fire the PLEvent, highly unlikely)

should be:

// If something bad happens here (meaning we can't fire the PLEvent, highly
unlikely)

More explanation beyond Comment #1:

The problem is that the MsgPrintEngine is being notified as a listener of
nsIWebProgressListener::STATE_STOP, and then calls Print on the DocumentViewer
(DV). The problem with this is that the DV checks to see if the document is
still busy, which it still is becuase the Doc's flags aren't reset to "not busy"
until after all the listeners are notified. The DV then "queues" the print
request because the document is busy. Later the Print happens but at that point
we have no way to tell the MsgPrintEngine that canceled happened.

The fix introduces the PLEvent so that the document can notify all the listeners
and then state the doc state to "not busy." So our PLEvent fires and says
"Print" the DV is no longer busy and the Print request doesn't get queued and
the return from the Print call is synchronuos with the proper error codes for
the MsgPrintEngine to do the right thing.

(BTW, we should copy these comments for documentation on mail printing)
Target Milestone: mozilla1.1alpha → mozilla1.2beta
this was fixed as part of a different bug
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: