From 6ba643516bd3a687501711ccf295f5d262e2cb12 Mon Sep 17 00:00:00 2001
From: Olivier Goffart <olivier.goffart@nokia.com>
Date: Wed, 25 Aug 2010 14:34:47 +0200
Subject: [PATCH] qmlobserver: workaround crash if an item has an infinite
 scale

infinite scale may occours if the qml scale binding sets an infinite scale.
---
 .../qtcreator/qmljsdebugger/editor/selectionindicator.cpp  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp b/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp
index 8b303276b81..585b54999c5 100644
--- a/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp
+++ b/share/qtcreator/qmljsdebugger/editor/selectionindicator.cpp
@@ -78,8 +78,11 @@ void SelectionIndicator::clear()
 QPolygonF SelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item, QPolygonF &polygon)
 {
     // ### remove this if statement when QTBUG-12172 gets fixed
-    if (item->boundingRect() != QRectF(0,0,0,0))
-        polygon = polygon.united(item->mapToScene(item->boundingRect()));
+    if (item->boundingRect() != QRectF(0,0,0,0)) {
+        QPolygonF bounding = item->mapToScene(item->boundingRect());
+        if (bounding.isClosed()) //avoid crashes if there is an infinite scale.
+            polygon = polygon.united(bounding);
+    }
 
     foreach(QGraphicsItem *child, item->childItems()) {
         if (!QDeclarativeDesignViewPrivate::get(m_view)->isEditorItem(child))
-- 
GitLab