Opened 18 years ago

Closed 17 years ago

Last modified 15 years ago

#345 closed bug (fixed)

Problems with printing to EPS

Reported by: tutey@… Owned by: rblazek
Priority: critical: causes crash or data corruption Milestone:
Component: Printing Version: Trunk
Keywords: Cc:
Must Fix for Release: Yes Platform: Linux
Platform Version: Ubuntu Dapper Awaiting user input: no

Description

Usually when I print to eps, QGIS segfaults with his last words being:

QgsComposerMap::recalculate mCalculate = 0
mUserExtent = 3687846.8754472997970879,5589402.1066110003739595 : 3691952.4785347003489733,5592168.8243129998445511
mScale = 0.82838
mExtent = 3687846.8754472997970879,5587870.7407767521217465 : 3691952.4785347003489733,5593700.1901472480967641
QgsComposerMap::setOptions
QgsComposerMap::recalculate mCalculate = 0
mUserExtent = 3687846.8754472997970879,5589402.1066110003739595 : 3691952.4785347003489733,5592168.8243129998445511
mScale = 0.82838
mExtent = 3687846.8754472997970879,5587870.7407767521217465 : 3691952.4785347003489733,5593700.1901472480967641
QgsComposerMap::setOptions
QgsComposerMap::setOptions
draw mPlotStyle = 0 mPreviewMode = 0
use cache
extent = 4105.6 x 5829.45
cache = 1000 x 1419
transform = Map units/pixel: 4.1056 X minimum: 3.68785e+06 Y minimum: 5.58787e+06 Y maximum: 1419
scale = 3.401
translate: 75, 101
draw mPlotStyle = 0 mPreviewMode = 0
use cache
extent = 4105.6 x 5829.45
cache = 1000 x 1419
transform = Map units/pixel: 4.1056 X minimum: 3.68785e+06 Y minimum: 5.58787e+06 Y maximum: 1419
scale = 3.401
translate: 75, 101
Resolution = 300
Print to file
draw mPlotStyle = 2 mPreviewMode = 0
render
Segmentation fault (core dumped)

gdb doesn't like the core dump, saying:

"/home/shoofi/core.14622" is not a core dump: File format not recognized

so I can't give you a backtrace. I have backed up this core dump. If you want it, I can send it by email (it's ~800 KB bzpipped).

To reproduce the segfault, try:

  1. add any layer (shape or raster, no matter)
  2. map composer
  3. format A4, orientation: portrait
  4. add a map
  5. print to eps
  6. segfault

Maciek

Attachments (3)

gminy.tar.bz2 (209.5 KB ) - added by tutey@… 17 years ago.
eps_artefact.png (6.5 KB ) - added by anonymous 17 years ago.
eps_artefact.2.png (6.5 KB ) - added by tutey@… 17 years ago.

Download all attachments as: .zip

Change History (25)

comment:1 by wonder, 18 years ago

Is there a difference between this ticket and #339 ?

Btw. to provide backtrace you run qgis this way: gdb /your/path/bin/qgis

When gdb has started, enter command run to the prompt and once qgis crashes type bt to see the backtrace.

comment:2 by tutey@…, 18 years ago

Component: Build/InstallPrinting
Milestone: Version 0.8 Release
Owner: changed from gsherman to rblazek
Platform: DebianLinux
Platform Version: Ubuntu Dapper
Version: HEAD

Is there a difference between this ticket and #339 ?

This one provides a bit more details, so propably #339 should be a duplicate of this one.

Btw. to provide backtrace you run qgis this way: gdb /your/path/bin/qgis

That's exactly what I'm doing. And I get:

"/home/shoofi/bugi/qgis/core.14622" is not a core dump: File format not recognized

comment:3 by tutey@…, 18 years ago

Oops sorry. Now I get it. Your procedure was different than the one proposed in FAQ of the QGIS site. Doing it as you suggested, I get:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1240062272 (LWP 5653)]
0x369b0000 in ?? ()
(gdb) bt
#0  0x369b0000 in ?? ()
#1  0xb7664759 in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#2  0xb76644ac in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#3  0xb7666728 in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#4  0xb766068a in QPaintDevice::~QPaintDevice ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#5  0xb761a44d in QPainter::drawPicture ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#6  0xb761aed8 in QPainter::drawPolyline ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#7  0xb6ab0c41 in QgsVectorLayer::drawLineString (this=0x82f9110,
    feature=0x89bc4b8 "\001\002", hasZValue=false, p=0xbff2ee98,
    mtp=0xbff2ea80, projectionsEnabledFlag=false, drawingToEditingCanvas=false)
    at qpainter.h:477
#8  0xb6ab11bf in QgsVectorLayer::drawFeature (this=0x82f9110, p=0xbff2ee98,
    fet=0x82f5a34, theMapToPixelTransform=0xbff2ea80, marker=0xbff2e844,
    markerScaleFactor=5, projectionsEnabledFlag=false,
    drawingToEditingCanvas=false) at qgsvectorlayer.cpp:3420
#9  0xb6ab8799 in QgsVectorLayer::draw (this=0x82f9110, p=0xbff2ee98,
    viewExtent=0x82f5a34, theMapToPixelTransform=0xbff2ea80,
---Type <return> to continue, or q <return> to quit---q
drawingToEditingCanQuit
) at qgsvectorlayer.cpp:920
#10 0xb7e81acc in QgsComposerMap::draw (this=0x855bb08, painter=0xbff2ee98,
    extent=0x855bbf4, transform=0xbff2ea80) at qgscomposermap.cpp:129
#11 0xb7e8305f in QgsComposerMap::draw (this=0x855bb08, painter=@0xbff2ee98)
    at qgscomposermap.cpp:285
#12 0xb7bb1e12 in Q3CanvasItemList::drawUnique ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#13 0xb7bb4dab in Q3Canvas::drawCanvasArea ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#14 0xb7bb4ea8 in Q3Canvas::drawArea ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQt3Support.so.4
#15 0xb7e688f9 in QgsComposer::on_mActionPrint_activated (this=0x80e30d0)
    at qgscomposer.cpp:349
#16 0xb7ea887d in QgsComposer::qt_metacall (this=0x80e30d0,
    _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x82f5a34)
    at qgscomposer.moc.cpp:91
#17 0xb7d634ba in QMetaObject::activate ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#18 0xb7d636f3 in QMetaObject::activate ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#19 0xb75584e1 in QAction::activated ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#20 0xb7558efc in QAction::activate ()
---Type <return> to continue, or q <return> to quit---
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#21 0xb7800c5a in QToolButton::nextCheckState ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#22 0xb7767757 in QButtonGroup::id ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#23 0xb77679c5 in QAbstractButton::mouseReleaseEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#24 0xb759c65c in QWidget::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#25 0xb7767eb0 in QAbstractButton::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#26 0xb7800a04 in QToolButton::event ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#27 0xb755cc95 in QApplicationPrivate::notify_helper ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#28 0xb755eb8a in QApplication::notify ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#29 0xb75af79d in QApplication::x11ProcessEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#30 0xb75aee68 in QApplication::x11ProcessEvent ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#31 0xb75c0ca5 in non-virtual thunk to QDesktopWidget::~QDesktopWidget() ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
---Type <return> to continue, or q <return> to quit---
#32 0xb7d5521e in QEventLoop::processEvents ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#33 0xb7d5543a in QEventLoop::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#34 0xb7d58217 in QCoreApplication::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtCore.so.4
#35 0xb755ca35 in QApplication::exec ()
   from /usr/local/Trolltech/Qt-4.1.4/lib/libQtGui.so.4
#36 0x0804c4d8 in main (argc=1, argv=0xbff30354) at main.cpp:604

comment:4 by g_j_m, 18 years ago

Ticket #339 gives a different way of failing to this ticket, but they look to be the same problem.

comment:5 by g_j_m, 18 years ago

Another 'crash with postscript' ticket is #141.

comment:6 by cavallini@…, 18 years ago

#141 is slightly different, as it occurs only when projects are more complex (several rasters), more often with larger sizes (A3) and only on pdf

comment:7 by gsherman, 17 years ago

Must Fix for Release: Yes

comment:8 by wonder, 17 years ago

Tested again with Qt 4.2.1 and seems to work well now. Can you retest?

comment:9 by cavallini@…, 17 years ago

Tested. In my setting it does not crash, but the eps produced is not valid (Cannot find BoundingBox). Furthermore, to choose the name of the file I have to deselect the "Print to file" option (that shows my default printer) and select it again (a minor annoyance).

comment:10 by wonder, 17 years ago

The annoyance with print dialog is a Qt bug reported here: http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=129148

What's wrong with the postscript file - only BoundingBox tag is missing or are there more problems? Does it happen always? What are the steps to reproduce it?

comment:11 by tutey@…, 17 years ago

No more segfault. But still no EPS created - I keep on getting error "Cannot find translate". This is another bug I reported as #339, which was marked as a duplicate of this bug.

comment:12 by rblazek, 17 years ago

Resolution: fixed
Status: newclosed

"Cannot find translate" is fixed in 6142.

Trolls are not going to release a decent printing devices?

Radim

comment:13 by tutey@…, 17 years ago

Radim,

What's the "6142" you refer to?

Thanks, Maciek

comment:14 by tutey@…, 17 years ago

OK, got it - it's SVN revision. Nevermind.

Cheers.

comment:15 by anonymous, 17 years ago

Resolution: fixed
Status: closedreopened

Radim wrote:

Cannot find translate" is fixed in 6142.

It is still mostly broken for me. Built SVN 6142 against QT 4.2.1, and:

  1. "Cannot find BoundingBox" error pops up when printing to check.eps
  1. I don't press the OK yet - I look whether the file was created first; and it is there, 1.8 MB. So I try to open it with PS viewer. This doesn't work and I'm told the file is in pdf format! So I rename the created "check.eps" into "check.pdf". Open it in acroread. It looks mostly OK, only the bottom is broken (was supposed to be A4).
  1. Return to QGIS and I press OK in the error dialog. Another one pops up: "Cannot find translate"; and the check.eps is created again, only 0 bytes this time. Then I press OK in this second error dialog. The check.eps is not overwritten again this time.

You can grab the check.pdf here: http://kufaya.googlepages.com/check.pdf

P.S Note also that it was qgis that put the .eps extension as default, in spite of creating a pdf, not me.

P.S.2 When I try to print to a printer, I'm told "The selected paper does not match the composition size", although I have carefully set A4, portrait everywhere, including the printer properties.

Cheers, Maciek

comment:16 by wonder, 17 years ago

Must Fix for Release: YesNo
Priority: criticalmajor
Summary: segfault when printing to EPSProblems with printing to EPS

Some problems with printing should be resolved in Qt 4.2.2.

in reply to:  16 ; comment:17 by tutey@…, 17 years ago

Must Fix for Release: NoYes
Priority: majorcritical

Replying to wonder:

Some problems with printing should be resolved in Qt 4.2.2.

After upgrading to QT 4.2.2 it is better now. Still bad though.

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: http://kufaya.googlepages.com/qgis.eps.bz2). This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

Moreover, although the "Print to file" is checked by defualt when entering the print menu, the dialog for the path to output eps file is not active - my printers are listed there instead. I have to uncheck the "Print to file" and check it back, for the path-dialog to become available.

Cheers, Maciek

by tutey@…, 17 years ago

Attachment: gminy.tar.bz2 added

by anonymous, 17 years ago

Attachment: eps_artefact.png added

by tutey@…, 17 years ago

Attachment: eps_artefact.2.png added

in reply to:  17 comment:18 by wonder, 17 years ago

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: http://kufaya.googlepages.com/qgis.eps.bz2). This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

This seems to be another Qt4 rendering bug. I'll try to figure out what's going on here.


Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

In what cases does it show up these messages? They come from composer as it tries to correct some values. Normally these strings should be in EPS, in PDF they're not used... this is invalid QGIS behaviour.


Moreover, although the "Print to file" is checked by defualt when entering the print menu, the dialog for the path to output eps file is not active - my printers are listed there instead. I have to uncheck the "Print to file" and check it back, for the path-dialog to become available.

This has been already reported by Paolo above in this ticket. Also a Qt bug - according to task tracker it should get fixed in Qt 4.3.0.

Martin

in reply to:  17 comment:19 by rblazek, 17 years ago

Replying to tutey@o2.pl:

No crashes anymore. But the eps output happens to be corrupted if it conatins polygons. Take the attached shapefile and compose a map out of it (A4, portrait). In the left-top corner you'll see bogus line rendered (see the attached png dump; you can grab the whole eps from here: http://kufaya.googlepages.com/qgis.eps.bz2). This is only an example, I can reproduce this bug with other polygon layers. It is reproducable, though I can't find a pattern for it.

Please fill in another ticket for this bug. I see the reason but no easy solution. The problem is that Qt (AFAIK) does not support rendering of polygons with holes. We use the trick when each hole is connected 2 lines from the first vertex of the polygon. This works on screen but it seems it does not work in PS. PS has its own correct method how to render polygons with holes but we cannot use it through Qt.

We could probably find for each hole a better outer polygon vertex so that the connection does not run outside the polygon but it can be CPU time consuming in case of large polygons with many holes.

Another thing is that printing to pdf still yields an error "Cannot find BoundingBox" and "Cannot find translate". Is printing to pdf not going to be supported (not a big deal for me, can always eps2pdf; but target QGIS users, especially those on Windows, might have a problem)? QT bug?

We have to check if translate/box modification is still necessary in Qt4.2.2 and if it is necessary for PDF and if it can be done for PDF.

Radim

comment:20 by rblazek, 17 years ago

The troubles with BoundingBox and translate are caused by the fact that in Qt (till 4.2.2) is not possible to set custom page size. That is problem especially for small EPS maps which need to be included in a text document.

According to http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=99441 it could be resolved in 4.3.0, but it is not sure yet if there will be a method to set custom page or it will be only possible from dialog.

Radim

comment:21 by rblazek, 17 years ago

Resolution: fixed
Status: reopenedclosed

The problem with BoundingBox and translate should be fixed in revision 6188. No it should only overwrite the BoundingBox and translate if output format is PS or EPS. That is determined according to the output file extension (.ps, .eps) because mPrinter->outputFormat() does not work (always 0 ).

Please test. I am going to close this ticket and open a new for the problem with polygon holes.

Radim

comment:22 by (none), 15 years ago

Milestone: Version 0.8

Milestone Version 0.8 deleted

Note: See TracTickets for help on using tickets.