Bug 131697 - Label creation and subsequent move can cause Kst to crash
Summary: Label creation and subsequent move can cause Kst to crash
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-02 00:43 UTC by Andrew Walker
Modified: 2007-01-06 01:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

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

PROBLEM:
When the user creates a label and subsequently tries to move it Kst may crash

STEPS TO REPRODUCE:
Start Kst
Create a single plot
Switch to label mode
Drag the mouse close to the lower left corner to create a new label
In the Edit Label dialog enter a long text string (some 100 characters or so)
In the Edit Label dialog Set both the margin and font size to 50
Hit OK in the Edit Label dialog
Switch to layout mode
Double click on the portion of the label that is visible

RESUSTS:
Kst crashes

EXPECTED RESULTS:
Kst does not crash
Comment 1 Andrew Walker 2006-08-03 20:21:15 UTC
The essential problem here is that the size of the text label is determined not by the user but by the label text, font size, margin, etc. At the time of this size determination no check is made to ensure that the label will actually fit within its window.
Comment 2 Andrew Walker 2007-01-06 01:40:09 UTC
SVN commit 620438 by arwalker:

BUG:131697 Ensure that the child object falls within the parent. Previously this was being done only for the contentsRect of the child, which is necessarily smaller than the overall geometry of the child. This fix prevents the described crash and provides a better visual result when a label is too large to fit within its parent.

 M  +4 -0      kstborderedviewobject.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstborderedviewobject.cpp #620437:620438
@@ -201,6 +201,10 @@
   _geom.setY(rect.top() - mpb);
   _geom.setWidth(rect.width() + 2 * mpb);
   _geom.setHeight(rect.height() + 2 * mpb);
+  
+  if(_parent) {
+    _geom = _geom.intersect(_parent->geometry());
+  }
 }