From 7bb0c86cf6772b39f78c87e8e091c0a2fd94f5ea Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 15 Jul 2023 10:43:00 +0300 Subject: [PATCH] kdeplasma-addons: parent the weather validator to the weather location finder Signed-off-by: Ivailo Monev --- kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp | 8 ++++---- .../libs/plasmaweather/weatherpopupapplet.cpp | 4 ++-- kdeplasma-addons/libs/plasmaweather/weathervalidator.cpp | 4 ++-- kdeplasma-addons/libs/plasmaweather/weathervalidator.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp b/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp index 5e093c1c..e06d6f1c 100644 --- a/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp +++ b/kdeplasma-addons/libs/plasmaweather/weatherlocation.cpp @@ -28,7 +28,8 @@ class WeatherLocation::Private public: Private(WeatherLocation *location) : q(location), - locationEngine(nullptr) + locationEngine(nullptr), + weatherEngine(nullptr) { } @@ -64,8 +65,7 @@ WeatherLocation::WeatherLocation(QObject *parent) WeatherLocation::~WeatherLocation() { - qDeleteAll(d->validators.keys()); - d->validators.clear(); + Q_ASSERT(d->validators.size() == 0); delete d; } @@ -98,7 +98,7 @@ void WeatherLocation::dataUpdated(const QString &source, const Plasma::DataEngin city.truncate(city.indexOf(QLatin1Char(',')) - 1); } if (!city.isEmpty()) { - WeatherValidator* validator = new WeatherValidator(); + WeatherValidator* validator = new WeatherValidator(this); validator->setDataEngine(d->weatherEngine); connect( validator, SIGNAL(finished(QMap)), diff --git a/kdeplasma-addons/libs/plasmaweather/weatherpopupapplet.cpp b/kdeplasma-addons/libs/plasmaweather/weatherpopupapplet.cpp index 768cf63b..05298d23 100644 --- a/kdeplasma-addons/libs/plasmaweather/weatherpopupapplet.cpp +++ b/kdeplasma-addons/libs/plasmaweather/weatherpopupapplet.cpp @@ -81,9 +81,9 @@ public: q->setBusy(false); q->showMessage(QIcon(), QString(), Plasma::ButtonNone); q->setConfigurationRequired(true); - location->deleteLater(); - location = 0; } + delete location; + location = 0; } void giveUpBeingBusy() diff --git a/kdeplasma-addons/libs/plasmaweather/weathervalidator.cpp b/kdeplasma-addons/libs/plasmaweather/weathervalidator.cpp index da84abb3..c5d15eb8 100644 --- a/kdeplasma-addons/libs/plasmaweather/weathervalidator.cpp +++ b/kdeplasma-addons/libs/plasmaweather/weathervalidator.cpp @@ -26,7 +26,7 @@ class WeatherValidator::Private { public: Private() - : dataengine(0), + : dataengine(nullptr), ion(QLatin1String( "wettercom" )) {} @@ -36,7 +36,7 @@ public: bool silent; }; -WeatherValidator::WeatherValidator(QWidget *parent) +WeatherValidator::WeatherValidator(QObject *parent) : QObject(parent) , d(new Private()) { diff --git a/kdeplasma-addons/libs/plasmaweather/weathervalidator.h b/kdeplasma-addons/libs/plasmaweather/weathervalidator.h index eb335589..4198a2da 100644 --- a/kdeplasma-addons/libs/plasmaweather/weathervalidator.h +++ b/kdeplasma-addons/libs/plasmaweather/weathervalidator.h @@ -33,7 +33,7 @@ class PLASMAWEATHER_EXPORT WeatherValidator : public QObject { Q_OBJECT public: - WeatherValidator(QWidget *parent = 0); + WeatherValidator(QObject *parent = 0); virtual ~WeatherValidator(); /**