Ticket #345 (closed bug: fixed)

Opened 7 years ago

Last modified 4 years ago

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:
Platform Version: Ubuntu Dapper Platform: Linux
Must Fix for Release: Yes Awaiting user input:

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

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

Change History

  Changed 7 years ago by wonder

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.

  Changed 7 years ago by tutey@…

  • component changed from Build/Install to Printing
  • platform_version set to Ubuntu Dapper
  • platform changed from Debian to Linux
  • version set to HEAD
  • milestone set to Version 0.8 Release
  • owner changed from gsherman to rblazek

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

  Changed 7 years ago by tutey@…

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

  Changed 7 years ago by g_j_m

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

  Changed 7 years ago by g_j_m

Another 'crash with postscript' ticket is #141.

  Changed 7 years ago by cavallini@…

#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

  Changed 7 years ago by gsherman

  • must_fix set to Yes

  Changed 7 years ago by wonder

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

  Changed 7 years ago by cavallini@…

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).

  Changed 7 years ago by wonder

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?

  Changed 7 years ago by tutey@…

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.

  Changed 6 years ago by rblazek

  • status changed from new to closed
  • resolution set to fixed

"Cannot find translate" is fixed in 6142.

Trolls are not going to release a decent printing devices?

Radim

  Changed 6 years ago by tutey@…

Radim,

What's the "6142" you refer to?

Thanks, Maciek

  Changed 6 years ago by tutey@…

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

Cheers.

  Changed 6 years ago by anonymous

  • status changed from closed to reopened
  • resolution fixed deleted

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

2. 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).

3. 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

follow-up: ↓ 17   Changed 6 years ago by wonder

  • priority changed from critical to major
  • summary changed from segfault when printing to EPS to Problems with printing to EPS
  • must_fix changed from Yes to No

Some problems with printing should be resolved in Qt 4.2.2.

in reply to: ↑ 16 ; follow-ups: ↓ 18 ↓ 19   Changed 6 years ago by tutey@…

  • priority changed from major to critical
  • must_fix changed from No to Yes

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

Changed 6 years ago by tutey@…

Changed 6 years ago by anonymous

Changed 6 years ago by tutey@…

in reply to: ↑ 17   Changed 6 years ago by wonder

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   Changed 6 years ago by rblazek

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

  Changed 6 years ago by rblazek

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

  Changed 6 years ago by rblazek

  • status changed from reopened to closed
  • resolution set to fixed

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

  Changed 4 years ago by anonymous

  • milestone Version 0.8 deleted

Milestone Version 0.8 deleted

Note: See TracTickets for help on using tickets.