From 5edef5e181e0f3cf2e04182d06b3c781717e6f87 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Tue, 5 Sep 2017 18:37:09 +0200 Subject: Fix enabling polymorphic pimpl in QGeoRoute/Segment/Maneuver Change 8ac6377e62af803b567449cdf30c669b92114cc4 allowed to subclass private implementations of these 3 classes. However, the pimpl was kept in a QExplicitlySharedDataPointer for the first two, and QSharedDataPointer for the last class. Failing to specialize the clone method of the pointer would result in incorrect detach behavior, which would however only be visible with the third class (the first two never call detach() internally, and the line QEXPECT_FAIL("", "QGeoRoute equality operators broken", Continue); in the tests make it clear. This change also adds the equals virtual method also to QGeoRouteSegment and QGeoManeuver private implementations. Change-Id: If51dafebb19e4cb2d1bcf40c2b6f136f804198e0 Reviewed-by: Alex Blasche --- src/location/maps/qgeoroute.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/location/maps/qgeoroute.cpp') diff --git a/src/location/maps/qgeoroute.cpp b/src/location/maps/qgeoroute.cpp index 95603218..2e7b259a 100644 --- a/src/location/maps/qgeoroute.cpp +++ b/src/location/maps/qgeoroute.cpp @@ -44,6 +44,12 @@ QT_BEGIN_NAMESPACE +template<> +QGeoRoutePrivate *QExplicitlySharedDataPointer::clone() +{ + return d->clone(); +} + /*! \class QGeoRoute \inmodule QtLocation @@ -434,6 +440,11 @@ QGeoRoutePrivateDefault::QGeoRoutePrivateDefault(const QGeoRoutePrivateDefault & QGeoRoutePrivateDefault::~QGeoRoutePrivateDefault() {} +QGeoRoutePrivate *QGeoRoutePrivateDefault::clone() +{ + return new QGeoRoutePrivateDefault(*this); +} + void QGeoRoutePrivateDefault::setId(const QString &id) { m_id = id; -- cgit v1.2.1