[Bugfix] Fix unconsistent remove in PlacemarkLayout

?? WANG Cui iucgnaw at msn.com
Sat Mar 25 14:24:23 GMT 2023


Hi,
When I check Marble GitHub, but don't find guidance which branch to do pull request, therefore I submit bugfix patch here.
In PlacemarkLayout, when remove a placemark, m_paintOrder item is not removed when m_visiblePlacemarks remove item. In extreme case ( i.e. updateFeature() during plugin render() ), the m_paintOrder refer to deleted Placemark then segmentation fault.
Patch is as attached.

diff --git a/src/lib/marble/PlacemarkLayout.cpp b/src/lib/marble/PlacemarkLayout.cpp
index a66a1f46c..3c684b662 100644
--- a/src/lib/marble/PlacemarkLayout.cpp
+++ b/src/lib/marble/PlacemarkLayout.cpp
@@ -271,6 +271,7 @@ void PlacemarkLayout::removePlacemarks( const QModelIndex& parent, int first, in

         int zoomLevel = placemark->zoomLevel();
         TileId key = TileId::fromCoordinates( coordinates, zoomLevel );
+        m_paintOrder.erase(std::remove(m_paintOrder.begin(), m_paintOrder.end(), m_visiblePlacemarks[placemark]), m_paintOrder.end());
         delete m_visiblePlacemarks[placemark];
         m_visiblePlacemarks.remove(placemark);
         m_placemarkCache[key].removeAll( placemark );

WANG Cui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20230325/ce3a8212/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugfix.patch
Type: application/octet-stream
Size: 713 bytes
Desc: bugfix.patch
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20230325/ce3a8212/attachment.obj>


More information about the Marble-devel mailing list