Closed Bug 83138 Opened 23 years ago Closed 23 years ago

[FIX]crash when print range pages 2->2 of local file to printer

Categories

(Core :: Printing: Output, defect)

x86
Windows NT
defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: Brade, Assigned: rods)

Details

(Keywords: crash, regression, Whiteboard: Fix in Hand, have r=, need sr=, and a=)

Using a mozilla build from this morning, I am unable to print page 2->2 of a 
local file.  I crash in nsPageFrame.cpp in nsPageFrame::Paint() on this line:
    mPrintOptions->GetMarginInTwips(mMargin);
because mPrintOptions' raw ptr is null.

I am able to print page 1->1 of the same file.

I also noticed that I could *not* print page 2->2 of Sample 4 in the debug menu 
but I could print page 2->2 of Sample 5.
I looked at this, along with Rod and we determined a few things.
1.)  This is a regression.  We could get sample 0 to break, printing 2 of 2, 
this was the test case Rod used to test with. 
2.)  This crashes becauses an nsPageFrame is not set up correctly.  The reason 
is because the correct nsPageFrame is set up, but the ViewManager prints the 
wrong nsPageFrame that did not get set up for printing.
3.)  This problem can be fixed if the view of the pages not printed are either 
hidden or there hieght is set to 0.   
Give back to me if you want me to finish this out.
Assignee: dcone → rods
Patch:

Index: nsSimplePageSequence.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/base/src/nsSimplePageSequence.cpp,v
retrieving revision 3.42
diff -u -r3.42 nsSimplePageSequence.cpp
--- nsSimplePageSequence.cpp	2001/04/25 14:26:28	3.42
+++ nsSimplePageSequence.cpp	2001/05/29 21:50:17
@@ -570,7 +570,8 @@
       if (pageNum < mFromPageNum || pageNum > mToPageNum) {
         // XXX Doesn't seem like we need to do this
         // because we ask only the pages we want to print
-        //view->SetVisibility(nsViewVisibility_kHide);
+        view->SetVisibility(nsViewVisibility_kHide);
+        view->SetChildClip(0,0,0,0);
       } else {
         nsRect rect;
         page->GetRect(rect);
Status: NEW → ASSIGNED
Keywords: crash
Summary: crash when print range pages 2->2 of local file to printer → [FIX]crash when print range pages 2->2 of local file to printer
Whiteboard: Fix in Hand
Target Milestone: --- → mozilla0.9.1
you also need to add the following to make the SetChildClip have an affect.

view->SetViewFlags(NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN);

Provided you add the following line:

r=kmcclusk@netscape.com
who is a good super reviewer for this?
Whiteboard: Fix in Hand → Fix in Hand, have r=, need sr=, and a=
I asked attinasi, but maybe hyatt....I also send it to him. This is an important 
oone to get in.
Keywords: regression
Final patch with updated comments and Kevin's suggestion:

Index: nsSimplePageSequence.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/base/src/nsSimplePageSequence.cpp,v
retrieving revision 3.42
diff -u -r3.42 nsSimplePageSequence.cpp
--- nsSimplePageSequence.cpp    2001/04/25 14:26:28     3.42
+++ nsSimplePageSequence.cpp    2001/05/30 13:03:21
@@ -568,9 +568,13 @@
       page->GetView(aPresContext, &view);
       NS_ASSERTION(nsnull != view, "no page view");
       if (pageNum < mFromPageNum || pageNum > mToPageNum) {
-        // XXX Doesn't seem like we need to do this
-        // because we ask only the pages we want to print
-        //view->SetVisibility(nsViewVisibility_kHide);
+        // Hide the pages that won't be printed to the Viewmanager
+        // doesn't put them in the display list. Also, makde
+        // sure the child views don't get asked to print
+        // but my guess is that there won't be any
+        view->SetVisibility(nsViewVisibility_kHide);
+        view->SetChildClip(0,0,0,0);
+        view->SetViewFlags(NS_VIEW_PUBLIC_FLAG_CLIPCHILDREN);
       } else {
         nsRect rect;
         page->GetRect(rect);
sr=attinasi
fixed
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.