[comp.sys.mac.programmer] PrintMgr Bug?

alan@metasoft.UUCP (Alan Epstein) (05/06/88)

i think i may have discovered an elusive bug in the print
manager, print glue or printer drivers (notably but not
restricted to the LW). all this relates to Design/2.0 which
is built using LightSpeed C (v2.15).

what i am doing is constructing an ordinary grafport which contains a
collection of boxes and polygons numbering less than 60. the polygons
are each about 38 bytes in size (about 6 vertices). when 'update' time
occurs, i write the objects to the device (screen or printer) using FrameRect
and FramePoly trap calls. all according to guidelines.

i have been able to construct cases where one or more of the polygons is
printed incorrectly -- part way thru the drawing, the polygon
is drawn to some incorrect position, indicating that the
points vector had been damaged. the next polygon is always fine.
on the other hand, using the same basic code, drawing the same set
of polygons to the screen never fails.

i have walked thru some of the print manager code and discovered that
when an offending polygon is being sent to the print driver (via
FramePoly), a call to PFDumpBuf() is invoked by PFOut() (both I assume
internal print manager or glue routines for which i have no documentation).
there appears to be a direct correlation between polygon failures
and calls to PFDumpBuf().

my hypothesis is that under certain circumstances, during a FramePoly
call, part of this polygon is written to the print port, the buffer
becomes full, requiring it to be flushed, and upon returning, PFOut
is no longer able to remember where it left off and writes some bogus
polygon segments for the remainder of the count.

this occurs on a Mac II (4Meg) or a Mac + (2Meg). it matters not whether
the polygons are locked prior to calling FramePoly (although i see that
FramePoly locks them anyway), nor is the presence of a printer
idle routine important.

although the problem manifests without any special debugging tools, it
is possible to exacerbate the failures (cause them where they were not
otherwise occurring), by using the TMON 'heap scramble' option. again,
the problem occurs without scramble.

i'm interested in learning from anyone who may have seen anything
remotely related to these bugs. i'd also like to hear from anyone
at apple who knows the internals of the printer manager & drivers
since i think that's where the problem lies.

feel free to call if you'd like further information.

	alan epstein
	meta software corp
	(617) 576.6920

	[ alan%metasoft@bbn.com	] or
	[ bbn!metasoft!alan		]

alan@metasoft.UUCP (Alan Epstein) (05/15/88)

it appears there really is a bug in the LW driver. the complaint
was when printing polygons, random lines would be drawn across
the paper. apple's reply follows:







------------------------------------------

> scott douglass <scott@apple.com> writes:

> I've got an answer.  Unfortunately the problem stems from a scamble
> bug in the LW driver.  The problem can occur anytime the LW is drawing
> a QD polygon and it has to dump its PostScript buffer.  In spite of the
> indications you saw, this bug is not related to spooling and can happen
> even when priting direct although printing under PrintMonitor may
> aggravate the problem.  The bug has been in the LW since about
> version 3.3.  It is NOT fixed in the lastest driver (5.2, I believe)
> that just shipped with System 6.0.  This bug should be fixed in the
> next version of the LW with System 7.0, which is due out in the fall.

> One way to work around this problem would be to use the PicComment
> polygon feature of the LW instead of normal QD polygons.  This is
> described in the LW ref manual and the technote on LW piccomments.
> This does not, however, work on the ImageWriter.  You would have to
> special case the LW in your print code.

> I'm sorry that the news isn't better.  Thanks for bringing the bug
> to our attention.

------------------------------------------


-----------------------------
Alan Epstein
Meta Software Corp                   UUCP:  ...bbn!metasoft!alan
150 Cambridgepark Dr        Internet/ARPA:  alan%metasoft@bbn.com
Cambridge, MA 02140  USA
-----------------------------