[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Thu Oct 2 21:21:20 CEST 2003


CVS commit by harris: 

Fixed crash condition: requesting an image dump with width less than 
380 caused a crash.  Traced the problem to the definition of the 
xscale/yscale parameters in SkyMap::exportSkyImage():

  double xscale = pdm.width() / width();
  double yscale = pdm.height() / height();

The width() and height() functions return integers, so if pdm.width() < 
width() then xscale is incorrectly set to 0.0.  This eventually 
propogates to a div-by-zero.  Fixed by wrapping the width/height in 
"double()".

The reason this only manifests when width is smaller than 380 is that the 
skymap widget gets resized to 380 when it is small, but the 
PaintDeviceMetric (pdm) remains at the original value.  For widths above 
380, width()==pdm.width() and xscale==1.0.

Thanks to Tobias Koenig for pointing out the problem.

CCMAIL: kstars-devel at kde.org
CCMAIL: tokoe at kde.org


  M +3 -2      skymapdraw.cpp   1.39


--- kdeedu/kstars/kstars/skymapdraw.cpp  #1.38:1.39
@@ -1476,6 +1477,6 @@ void SkyMap::exportSkyImage( const QPain
 
         //scale image such that it fills 90% of the x or y dimension on the paint device
-        double xscale = pdm.width() / width();
-        double yscale = pdm.height() / height();
+        double xscale = double(pdm.width()) / double(width());
+        double yscale = double(pdm.height()) / double(height());
         double scale = (xscale < yscale) ? xscale : yscale;
 




More information about the Kstars-devel mailing list