mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mapwidget: add the 'isReady' flag to the Map component
The 'isReady' boolean flag is now set to 'true' only once the Component.onCompleted slot is reached. The flag is then used as a safe-guard in the onZoomLevelChanged slot. Calculate the small circle radius (mapHelper.calculateSmallCircleRadius()) only if 'isReady' is set to true. Prevents a crash if the Map widget is not ready, yet a zoom level is set via the 'zoomLevel' property. The crash happens because mapHelper.calculateSmallCircleRadius() has a callback to the Map component to estimate some points and distances of the small circle. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
6d81e19eae
commit
9367610220
1 changed files with 6 additions and 1 deletions
|
@ -37,8 +37,13 @@ Item {
|
|||
property real newZoom: 1.0
|
||||
property real newZoomOut: 1.0
|
||||
property var clickCoord: QtPositioning.coordinate(0, 0)
|
||||
property bool isReady: false
|
||||
|
||||
onZoomLevelChanged: mapHelper.calculateSmallCircleRadius(map.center)
|
||||
Component.onCompleted: isReady = true
|
||||
onZoomLevelChanged: {
|
||||
if (isReady)
|
||||
mapHelper.calculateSmallCircleRadius(map.center)
|
||||
}
|
||||
|
||||
MapItemView {
|
||||
id: mapItemView
|
||||
|
|
Loading…
Add table
Reference in a new issue