[KimDaBa] Strange crash with KimDaBa and SUSE 9.1 with KDE 3.3.2

Robert L Krawitz rlk at alum.mit.edu
Wed Dec 29 18:00:15 GMT 2004


   Date: Wed, 29 Dec 2004 11:27:45 -0500
   From: Robert L Krawitz <rlk at alum.mit.edu>

   I'm having a seg fault with the above-mentioned configuration when
   I try to load a TIFF file.  It didn't happen when I was running
   3.3.1; it's when I upgraded to the 3.3.2 RPM's that this started to
   happen.  It doesn't always happen (I don't have a repeatable test
   case, but trying enough times eventually causes it to happen), but
   it seems to happen more often with big files (and I have some
   *really* big TIFF files -- 110 MB scans).  Sometimes it doesn't
   crash, but it also doesn't load the image (the image comes out
   blank), and sometimes it does load the image.

So it looks like the QT_HAVE_MAX_IMAGE_SIZE code I put in (at least
the one in imageloader.cpp) is the culprit here, although it's not
evident why.  The debug line is a distraction; I think I put it in and
then on a whim #ifdef'ed out the QT_HAVE_MAX_IMAGE_SIZE code.

I would suggest removing this code.  This isn't the right place to do
it, anyway; the right thing to do is to set it in your kdeglobals file
if you're actually cursed with this.  What kimdaba should do is check
the return value from QImage::load().  If you do want to keep it,
change it something like as follows (make sure that the current max
size is greater than zero -- if it isn't, then the size is not
bounded):

#ifdef QT_HAVE_MAX_IMAGE_SIZE
         //
	  QSize max_size = QImage::maxImageSize();
	  if (max_size.width() > 0 && max_size.width() < (int) li.width()) {
	    max_size.setWidth(li.width());
           QImage::setMaxImageSize(max_size);
	  }
	  if (max_size.height() > 0 && max_size.height() < (int) li.height()) {
	    max_size.setHeight(li.height());
	    QImage::setMaxImageSize(max_size);
	  }
#endif

This is dangerous if the image loader ever becomes multi-threaded;
it would need to be serialized.

The setting in kdeglobals looks like this:

[KDE]
MaxImageSize=0,0



More information about the Kphotoalbum mailing list