Bug 126992 - Crash when printing plot with legend
Summary: Crash when printing plot with legend
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-09 00:10 UTC by Andrew Walker
Modified: 2006-05-10 18:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch (6.57 KB, patch)
2006-05-09 22:48 UTC, Andrew Walker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-05-09 00:10:44 UTC
Version:           HEAD (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:
Kst crashes when printing a plot that contains a legend

STEPS TO REPRODUCE:
Start Kst
Launch the data wizard
Create a single plot with the Legend turned on
Select File...Print...


EXPECTED RESULTS:
File is saved

RESULTS:
Kst crashes
Comment 1 George Staikos 2006-05-09 14:11:17 UTC
Can't reproduce.
Comment 2 Andrew Walker 2006-05-09 22:48:06 UTC
Created attachment 15995 [details]
Proposed patch

The problem was that updateSelf() in Kst2dPlot was being called from
revertForPrint(). This was causing a negatively sized plot region. Once this
propagated through to KstViewLegend the resulting null bitmap resulted in a
crash.

The revertForPrint() is no longer necessary as the various bugs in the clip
region and buffering have since been addressed.
Comment 3 Andrew Walker 2006-05-10 18:58:27 UTC
SVN commit 539423 by arwalker:

BUG:126992 A narrower fix than the proposed patch, as we may wish to later change the printing resize functions

 M  +10 -8     kstviewlegend.cpp  
 M  +0 -3      kstviewobject.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #539422:539423
@@ -207,14 +207,16 @@
   setDirty(false);
 
   _backBuffer.buffer().resize(contentsRect().size());
-  _backBuffer.buffer().fill(backgroundColor());
-  KstPainter p;
-  p.begin(&_backBuffer.buffer());
-  QPen pen;
-  pen.setColor(foregroundColor());
-  p.setPen(pen);
-  drawToPainter(p);
-  p.end();
+  if (!_backBuffer.buffer().isNull()) {
+    _backBuffer.buffer().fill(backgroundColor());
+    KstPainter p;
+    p.begin(&_backBuffer.buffer());
+    QPen pen;
+    pen.setColor(foregroundColor());
+    p.setPen(pen);
+    drawToPainter(p);
+    p.end();
+  }
 }
 
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewobject.cpp #539422:539423
@@ -625,7 +625,6 @@
 void KstViewObject::parentResizedForPrint() {
   _geomOld = _geom;
   updateFromAspect();
-  //updateSelf();
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     (*i)->parentResizedForPrint();
   }
@@ -634,8 +633,6 @@
 
 void KstViewObject::parentRevertedForPrint() {
   _geom = _geomOld;
-  invalidateClipRegion();
-  updateSelf();
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     (*i)->parentRevertedForPrint();
   }