diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-09-05 18:37:09 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-10-19 11:00:15 +0000 |
commit | 5edef5e181e0f3cf2e04182d06b3c781717e6f87 (patch) | |
tree | 4b4e090abc925081e73e6c1695d45b5af5ea1584 /src/location/maps/qgeoroute.cpp | |
parent | c61f38b10bf6b4521ec8f847b8d4d5ec47477074 (diff) | |
download | qtlocation-5edef5e181e0f3cf2e04182d06b3c781717e6f87.tar.gz |
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 <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps/qgeoroute.cpp')
-rw-r--r-- | src/location/maps/qgeoroute.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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<QGeoRoutePrivate>::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; |