[Uml-devel] Spurious segfault on click on note or enum widgets in class diagram

Achim Spangler Achim.Spangler at mnet-online.de
Wed May 17 09:11:12 UTC 2006


Hi,
the current version of umbrello from REPO suffers sometimes a segfault, when 
simple items like a note or enum widget is clicked.

The relevant part of the stacktrace is as follows:
[KCrash handler]
#6  0x08232efe in UMLWidgetController::getSmallestX ()
#7  0x0823319d in UMLWidgetController::updateSelectionBounds ()
#8  0x082333c0 in UMLWidgetController::mouseMoveEvent ()
#9  0x081b6dd3 in ToolBarState::mouseMove ()
#10 0x081b7a56 in ToolBarStateArrow::mouseMove ()
#11 0xb7243dc7 in QScrollView::viewportMouseMoveEvent ()


The following functions were a little unsafe:
int UMLWidgetController::getSmallestX(const UMLWidgetList &widgetList) {
int UMLWidgetController::getSmallestY(const UMLWidgetList &widgetList) {
int UMLWidgetController::getBiggestX(const UMLWidgetList &widgetList) {
int UMLWidgetController::getBiggestY(const UMLWidgetList &widgetList) {

The problem was:
When the widgetList is empty, so that the function it.toFirst() returns NULL, 
those functions dereferenced a NULL pointer without any check.

I fixed this in the attached patch.
I don't know, whether this is the only reason for the segfault. But this was 
in my opinion in any case a riscy code.

Bye,
Achim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umlwidgetcontroller.diff
Type: text/x-diff
Size: 1767 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20060517/72604eac/attachment.bin>


More information about the umbrello-devel mailing list