Bug 140790 - crash when saving .ps as .tif
Summary: crash when saving .ps as .tif
Status: VERIFIED FIXED
Alias: None
Product: karbon
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Tim Beaulen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-28 20:35 UTC by Thorsten Staerk
Modified: 2007-02-04 00:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
the ps file I am trying to convert (369.62 KB, application/postscript)
2007-01-28 20:37 UTC, Thorsten Staerk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten Staerk 2007-01-28 20:35:49 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

I open a .ps file (http://www.staerk.de/files/graph.ps) with karbon and try to save it as .tif file. I get a crash with the following backtrace:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread 1106558432 (LWP 27521)]
[KCrash handler]
#6  0x41556151 in QPixmap::convertToImage ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#7  0x405570cc in KoDocument::generatePreview (this=0x819ddd0, 
    size=@0xbfb3a824) at /root/svn/koffice/lib/kofficecore/KoDocument.cpp:1257
#8  0x40556b05 in KoDocument::savePreview (this=0x819ddd0, store=0x8dda550)
    at /root/svn/koffice/lib/kofficecore/KoDocument.cpp:1203
#9  0x4055d661 in KoDocument::saveNativeFormat (this=0x819ddd0, 
    file=@0xbfb3aaa8) at /root/svn/koffice/lib/kofficecore/KoDocument.cpp:1106
#10 0x40584b99 in KoFilterChain::inputFileHelper (this=0x8c0d388, 
    document=0x819ddd0, alternativeFile=@0xbfb3aaf0)
    at /root/svn/koffice/lib/kofficecore/KoFilterChain.cpp:456
#11 0x40584dac in KoFilterChain::inputFile (this=0x8c0d388)
    at /root/svn/koffice/lib/kofficecore/KoFilterChain.cpp:197
#12 0x40587597 in KoFilterChain::storageFile (this=0x8c0d388, 
    name=@0xbfb3ad1c, mode=Read)
    at /root/svn/koffice/lib/kofficecore/KoFilterChain.cpp:250
#13 0x426c49b2 in PngExport::convert (this=0x9104b60, from=@0x9104070, 
    to=@0x9104078) at /root/svn/koffice/filters/karbon/png/pngexport.cc:58
#14 0x405863e6 in KoFilterChain::ChainLink::invokeFilter (this=0x9104068, 
    parentChainLink=0x0)
    at /root/svn/koffice/lib/kofficecore/KoFilterChain.cpp:66
#15 0x405864d5 in KoFilterChain::invokeChain (this=0x8c0d388)
    at /root/svn/koffice/lib/kofficecore/KoFilterChain.cpp:150
#16 0x4056e327 in KoFilterManager::exp0rt (this=0x820e010, url=@0x819de38, 
    mimeType=@0xbfb3b0f4)
    at /root/svn/koffice/lib/kofficecore/KoFilterManager.cpp:302
#17 0x40561a1a in KoDocument::saveFile (this=0x819ddd0)
    at /root/svn/koffice/lib/kofficecore/KoDocument.cpp:421
#18 0x408b6179 in KParts::ReadWritePart::save (this=0x819ddd0)
    at /root/svn/kdelibs/kparts/part.cpp:547
#19 0x408b635b in KParts::ReadWritePart::saveAs (this=0x819ddd0, 
    kurl=@0xbfb3b3b0) at /root/svn/kdelibs/kparts/part.cpp:566
#20 0x4057d38f in KoMainWindow::saveDocument (this=0x81b2830, saveas=true, 
    silent=false) at /root/svn/koffice/lib/kofficecore/KoMainWindow.cpp:901
#21 0x40575bbb in KoMainWindow::slotFileSaveAs (this=0x81b2830)
    at /root/svn/koffice/lib/kofficecore/KoMainWindow.cpp:1148
#22 0x4057ab69 in KoMainWindow::qt_invoke (this=0x81b2830, _id=81, 
    _o=0xbfb3b6a8) at KoMainWindow.moc:179
#23 0x41600589 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#24 0x41600a30 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0x40e288a5 in KAction::activated (this=0x81c3ff0) at kaction.moc:176
#26 0x40e296f1 in KAction::slotActivated (this=0x81c3ff0)
    at /root/svn/kdelibs/kdeui/kaction.cpp:1102
#27 0x40e2c91f in KAction::slotPopupActivated (this=0x81c3ff0)
    at /root/svn/kdelibs/kdeui/kaction.cpp:1129
#28 0x40e2ccab in KAction::qt_invoke (this=0x81c3ff0, _id=16, _o=0xbfb3b834)
    at kaction.moc:219
#29 0x41600589 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x41940c82 in QSignal::signal () from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0x4161d35b in QSignal::activate () from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x417065c8 in QPopupMenu::mouseReleaseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#33 0x40e16e53 in KPopupMenu::mouseReleaseEvent (this=0x8225290, e=0xbfb3bdb4)
    at /root/svn/kdelibs/kdeui/kpopupmenu.cpp:508
#34 0x4163a398 in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#35 0x415a0d61 in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#36 0x415a1ec8 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#37 0x411154d0 in KApplication::notify (this=0xbfb3c144, receiver=0x8225290, 
    event=0xbfb3bdb4) at /root/svn/kdelibs/kdecore/kapplication.cpp:550
#38 0x4153c080 in QETWidget::translateMouseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#39 0x4153aa9b in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#40 0x4154eb7a in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#41 0x415b7c73 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#42 0x415b7b56 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#43 0x415a06af in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#44 0x40019147 in kdemain (argc=2, argv=0xbfb3c2c4)
    at /root/svn/koffice/karbon/main.cc:46
#45 0x080487d2 in main (argc=2, argv=0xbfb3c2c4) at kdeinit_karbon.cpp:2
Comment 1 Thorsten Staerk 2007-01-28 20:37:47 UTC
Created attachment 19459 [details]
the ps file I am trying to convert
Comment 2 Jan Hambrecht 2007-02-01 01:43:29 UTC
SVN commit 628943 by jaham:


* fix the png export by using the vcomputeboundingbox visitor
to calculate the documents bounding box
* do not consider deleted objects when computing the bounding box

This fixes bug 140790 because when exporting to tiff the filter
chain exports to png first and then uses a krita filter to convert
to tiff.

BUG:140790



 M  +6 -21     filters/karbon/png/pngexport.cc  
 M  +6 -0      karbon/visitors/vcomputeboundingbox.cc  


--- branches/koffice/1.6/koffice/filters/karbon/png/pngexport.cc #628942:628943
@@ -34,6 +34,7 @@
 #include "vselection.h"
 #include "vkopainter.h"
 #include "vlayer.h"
+#include "vcomputeboundingbox.h"
 
 #include <kdebug.h>
 
@@ -67,20 +68,11 @@
 	VDocument doc;
 	doc.load( docNode );
 
-	VLayerListIterator layerItr( doc.layers() );
-	VLayer *currentLayer;
+	// calculate the documents bounding box
+	VComputeBoundingBox bbox( true );
+	doc.accept( bbox );
+	const KoRect &rect = bbox.boundingRect();
 
-	for( ; currentLayer = layerItr.current(); ++layerItr )
-	{
-		if( currentLayer->state() == VObject::normal || currentLayer->state() == VObject::normal_locked || currentLayer->state() == VObject::selected )
-		{
-			doc.selection()->append(currentLayer->objects());
-		}
-	}
-
-	// get the bounding box of all selected objects:
-	const KoRect& rect = doc.selection()->boundingBox();
-
 	// create image with correct width and height
 	QImage img( int( rect.width() ), int( rect.height() ), 32 );
 	//img.setAlphaBuffer( true );
@@ -89,16 +81,9 @@
 	VKoPainter p( img.bits(), rect.width(), rect.height() );
 	p.clear( qRgba( 0xFF, 0xFF, 0xFF, 0xFF ) );
 	p.setWorldMatrix( QWMatrix().translate( -rect.x(), -rect.y() ) );
-	VObjectList objects = doc.selection()->objects();
-	VObjectListIterator itr = objects;
 
-	// we dont need the selection anymore:
-	doc.selection()->clear();
+	doc.draw( &p, &rect );
 
-	// paint shapes over image
-	for ( ; itr.current(); ++itr )
-		itr.current()->draw( &p, &rect );
-
 	QImage image = img.swapRGB();
 	QImage mirrored = image.mirror( false, true );
 	// save png
--- branches/koffice/1.6/koffice/karbon/visitors/vcomputeboundingbox.cc #628942:628943
@@ -38,6 +38,8 @@
 
 	for( ; itr.current(); ++itr )
 	{
+		if( itr.current()->state() == VObject::deleted )
+			continue;
 		// do not use hidden layers
 		if( m_omitHidden && ! isVisible( itr.current() ) )
 			continue;
@@ -52,6 +54,8 @@
 
 	for( ; itr.current(); ++itr )
 	{
+		if( itr.current()->state() == VObject::deleted )
+			continue;
 		// do not export hidden objects
 		if( m_omitHidden && ! isVisible( itr.current() ) )
 			continue;
@@ -66,6 +70,8 @@
 
 	for( ; itr.current(); ++itr )
 	{
+		if( itr.current()->state() == VObject::deleted )
+			continue;
 		// do not use hidden child objects
 		if( m_omitHidden && ! isVisible( itr.current() ) )
 			continue;
Comment 3 Thorsten Staerk 2007-02-04 00:53:46 UTC
Cool reaction time, correct solution.