| Summary: | ClipPainter does not handle LineEnd position | ||
|---|---|---|---|
| Product: | [Applications] marble | Reporter: | Dennis Nienhüser <nienhueser> |
| Component: | general | Assignee: | marble-bugs |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.6 (KDE 4.11) | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| URL: | https://forum.kde.org/viewtopic.php?f=217&t=109874&p=258141#p258141 | ||
| Latest Commit: | http://commits.kde.org/marble/c07305063dbd73d4bb524c6a2eae61a994c49977 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
Quoting the forum thread: "When drawing a polyline with a label at the end, out of bounds occurs in function ClipPainterPrivate::labelPosition (file ClipPainter.cpp)." Proposed fix: void ClipPainterPrivate::labelPosition( const QPolygonF & polygon, QVector<QPointF>& labelNodes, LabelPositionFlags labelPositionFlags) { int labelPosition = 0; <...> if ( polygon.size() > 1 && labelPositionFlags.testFlag( LineEnd ) ) { if ( pointAllowsLabel( polygon.at( polygon.size() - 1 ) ) ) { labelNodes << polygon.at( polygon.size() - 1 ); } ///# Error occurs at first iteration ///- // The Label at the start of the polyline: ///- for ( int it = polygon.size() - 1; it > 1; --it ) { ///# Instead use this: // The Label at the end of the polyline: for ( int it = polygon.size() - 2; it > 0; --it ) { ///# End of fix. currentAllowsLabel = pointAllowsLabel( polygon.at( it ) ); if ( currentAllowsLabel ) { QPointF node = interpolateLabelPoint( polygon.at( it + 1 ), polygon.at( it ), labelPositionFlags ); if ( node != QPointF( -1.0, -1.0 ) ) { labelNodes << node; } break; } } } }